0.0.12 • Published 6 years ago
iso-logger v0.0.12
IsoLogger
An isomorphic logger that uses Winston on the server and console on the client.
Installation
npm install iso-logger --save
Compilation
The WEB_ENV
environment variable must be set to 'true'
when you compile your browser bundle in order to exclude
Winston from the build.
Usage
// logger.js
import Logger from 'iso-logger';
const level = process.env.NODE_ENV === 'production' ? 'warn' : 'debug';
export default new Logger({ consoleOptions: { level }, winstonOptions: { level } });
// module.js
import logger from './logger';
logger.error('Oops, something went wrong...');
logger.warn('Beware the fury of a patient man.');
logger.info('It is a very sad thing that nowadays there is so little useless information.');
logger.verbose(
`How doth the little crocodile improve his shining tail. And pour
the waters of the Nile, on every golden scale. How cheerfully he seems to grin, how
neatly spreads his claws. And welcomes little fishes in, with gently smiling jaws.`
);
logger.debug('There are only two hard problems in Computer Science: cache invalidation and naming things.');
Documentation
Please read the documentation on the IsoLogger github pages.
License
IsoLogger is MIT Licensed.