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!