@magic/log
simple server side logging.
basically console.log + loglevels + process.env awareness
html-docs
installation:
npm install @magic/log
usage:
import
import log from '@magic/log'
log levels
log.setLevel('all')
log.setLevel(0)
log.setLevel('warn')
log.setLevel(1)
log.setLevel('error')
log.setLevel(2)
log.resetLevel()
log.getLevel()
log functions
log.info('Some interesting yet useless information')
log.success('yay', 'only the first', 'argument was green')
log.error('ERROR:', 'error messsage')
log.warn('WARN:', 'warn message')
log.annotate('Annotate this message')
const start = log.hrtime()
const delta = log.hrtime(start)
log.timeTaken(start, 'before', 'after')
changelog
#####v0.0.3
log.error now converts errors for better logging
0.1.0
use ecmascript modules
0.1.1
bump to get this version to be the default for install.
0.1.0-cjs was preferred, but is deprecated.
0.1.2
add log.hrtime and log.timeTaken
0.1.3
require node >= 13.5.0
0.1.4
log.timeTaken(time, pre, post):
if pre ends and post starts with a string delimiter,
the time value between those string delimiters does not get spaces added around it.
0.1.5
bump required node version to 14.2.0
0.1.6 - unreleased
...