1.2.8 • Published 2 years ago

shared-log v1.2.8

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

shared-log

npm Bundle size Code style: Prettier Donate

Decoupled logging for libraries

 

Usage

Libraries should import shared-log and treat it as write-only.

"Reading" the log (via event listener) is reserved for the end user.

import log from 'shared-log'

// The log function is console.log by default
log('all arguments', 'are passed thru')

// Log methods exist for each log level
log.error(new Error('ruh roh'))
log.warn(...)
log.info(...)
log.verbose(...)
log.debug(...)

The end user hooks up their logging library of choice.

import log from 'shared-log'

// Listen to every log level
log.on('all', (level, args, filename) => {...})

// or a specific log level
log.on('error', (args, filename) => {...})

If the end user doesn't add a log listener, the console is used by default, but the debug and verbose log levels are ignored by default.

1.2.8

2 years ago

1.2.7

2 years ago

1.2.6

2 years ago

1.2.5

2 years ago

1.2.4

3 years ago

1.2.0

3 years ago

1.2.3

3 years ago

1.2.2

3 years ago

1.2.1

3 years ago

1.1.0

3 years ago

1.0.0

3 years ago