use-simple-logger
v0.0.2
Published
Log state updates
Downloads
3
Readme
Use Simple Logger
A tiny (2kb) state inspector for Use Simple State, based on Redux Logger.
Logs action, time (HH:MM:SS:MS), previous state and next state:
Also handles async actions (intermediate state is ignored in final log):
Installation
yarn add use-simple-logger
npm install --save use-simple-logger
Usage
Import the middleware and pass to your SimpleStateProvider
:
import logger from 'use-simple-logger';
export default App () {
return (
<SimpleStateProvider reducers={reducers} middleware={[logger]}>
<RootComponent />
</SimpleStateProvider>
);
}
Note: the logger middleware should always go last
For more fine-grained control, you can import createLogger
and pass options:
import { createLogger } from 'use-simple-logger'
const options = {
logAction: true,
logPrev: true,
logNext: true
};
const logger = createLogger(options);