1.0.11 • Published 6 years ago

wraps-logger v1.0.11

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

wraps-logger

Work in progress!!

Winston wrapping function for logging

Installation

npm install wraps-logger

Usage

Default logger

import { logger } from 'wraps-logger'
logger.error('error');
logger.warn('warn');
logger.info('info');
logger.debug('debug');
logger.silly('silly!');
logger.debug('With', 'multiple', {parameter: 'types'}, ['winston','is','great!'])

Default logger example

Adding custom namespaces

import { COLORS, createNamespace, logger } from 'wraps-logger';

const nsp1 = createNamespace('LOGGER1');
const nsp2 = createNamespace('LOGGER2', {level: 'info'}, {color: COLORS.GREEN});
const nsp3 = createNamespace('LOGGER3', {level: 'debug'}, {label: 'CUSTOMLABEL'});
const nsp4 = createNamespace('ANOTHER', {level: 'debug'}, {prefix: '\u2709'});

nsp1.info('Minimal configuration. Automatic color selection');
nsp2.info(`Forced green color`);
nsp3.info(`With custom label`);
nsp4.info(`With custom prefix`);
logger.info(`I'm the default logger`);

Custom logger example

1.0.11

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.7

6 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago