0.3.9 • Published 3 days ago

@rokucommunity/logger v0.3.9

Weekly downloads
-
License
MIT
Repository
-
Last release
3 days ago

@RokuCommunity/logger

A node.js logger library for use in the RokuCommunity projects.

build status coverage status monthly downloads npm version license Slack

Installation

npm

npm install @rokucommunity/logger

Usage

//import the logger
const logger = require('logger');
logger.logLevel = 'trace';
logger.error('Critical failure');
logger.warn('Something might be wrong');
logger.log('Normal message');
logger.info('Might be interesting');
logger.debug('Probably not interesting');
logger.trace('Definitely not interesting');

Output:

image

Advanced Usage

Log inheritance and Prefixing

A Logger instance can inherit settings from a parent, only needing to provide settings for the values it wants to override. All loggers inherit from the base Logger that is the default export from this module.

Consider the following example:

const logger = require('./dist');
logger.log('Hello from logger');

const childLogger = logger.createLogger({prefix: '[Child]'});
childLogger.log('Hello from childLogger');

const grandchildLogger = childLogger.createLogger({prefix: '[Grandchild]'});
grandchildLogger.log('Hello from grandchildLogger');

Output:

[14:38:30.429][LOG] Hello from logger
[14:38:30.432][LOG] [Child] Hello from childLogger
[14:38:30.432][LOG] [Child][Grandchild] Hello from grandchildLogger
0.3.9

3 days ago

0.3.8

3 days ago

0.3.7

17 days ago

0.3.6

19 days ago

0.3.5

19 days ago

0.3.4

25 days ago

0.3.3

12 months ago

0.3.2

1 year ago

0.3.1

1 year ago

0.3.0

2 years ago

0.1.2

2 years ago

0.2.0

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago