1.0.11 • Published 5 years ago

wraps-logger v1.0.11

Weekly downloads
3
License
MIT
Repository
github
Last release
5 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

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago