A console logging middleware for MobX State Tree
MIT License
A console logging middleware for MobX State Tree
yarn add mst-log
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());
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 go to the redux-logger library for the inspiration in this one.
Thanks goes to these wonderful people (emoji key):
This project follows the all-contributors specification. Contributions of any kind welcome!