mst-log
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

MST Log

A console logging middleware for MobX State Tree

Install

yarn add mst-log

Usage

import { addMiddleware, types } from "mobx-state-tree";
import { mstLog } from "mst-log";

// Create your store
const myStore = types.model({}).create({});

// Attach the middleware
addMiddleware(myStore, mstLog());

Options

There are a few options you can provide to control how logging works:

type Options = {
  getCallTypeColor: (type: IMiddlewareEventType) => string;
  getShouldGroupBeCollapsed: (call: IMiddlewareEvent) => boolean;
  logger: Logger;
  getTime: () => number;
};

If theres some aspect you would like to be able to change please do open a PR :)

Thanks

Thanks go to the redux-logger library for the inspiration in this one.

Contributors

Thanks goes to these wonderful people (emoji key):


Mike Cann

💻

This project follows the all-contributors specification. Contributions of any kind welcome!

Readme

Keywords

none

Package Sidebar

Install

npm i mst-log

Weekly Downloads

16

Version

2.0.0

License

MIT

Unpacked Size

60.9 kB

Total Files

15

Last publish

Collaborators

  • mike.cann