2.2.3 • Published 5 years ago

mre-logger v2.2.3

Weekly downloads
-
License
MIT
Repository
gitlab
Last release
5 years ago

mre-logger

Sometimes you just want to write logs to stdout, print error stack traces, and configure levels. That's what you get here.

I realized I was using the fantastic winston logger for something that could be done in about 60 lines of code. So, there's one less dependency in my projects.

Usage

I like to get a single logger instance and use it throughout the app.

logger.js

import getLogger from 'mre-logger';

export default getLogger({ level: 'debug' }, process.env.NODE_ENV);

app.js

import logger from './logger';

logger.info('The %s is falling', 'sky', new Error('The system is down...'));

Notes

If the environment is set to test this won't output anything because I hate system log messages polluting my test run results.

This is basically just a fancy wrapper around Node's util.format(). Anything you pass in, just gets passed right on through to that and written to the process's standard out. Simple.

2.2.3

5 years ago

2.2.2

5 years ago

2.2.1

5 years ago

2.2.0

5 years ago

2.1.0

6 years ago

2.0.5

6 years ago

2.0.4

6 years ago

2.0.3

6 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.2.0

7 years ago

1.1.0

7 years ago

1.0.0

7 years ago

0.2.0

7 years ago

0.1.0

7 years ago