Package Exports
- @magic/log
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@magic/log) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@magic/log
simple server side logging.
basically console.log + loglevels + process.env awareness
installation:
npm install @magic/logusage:
import
const log = require('@magic/log')log levels
// set logLevel to all
log.setLevel('all')
log.setLevel(0)
// logLevel warn
log.setLevel('warn')
log.setLevel(1)
// only log errors:
log.setLevel('error')
log.setLevel(2)
// if production, set logLevel to "warn", if development, "all"
log.resetLevel()
// get current logLevel
log.getLevel()log functions
// only outputs if logLevel === 'all'
log.info('Some interesting yet useless information')
// only outputs if logLevel === 'all'.
// output of first argument is green.
log.success('yay', 'only the first', 'argument was green')
// always outputs. first argument will be red
log.error('ERROR:', 'error messsage')
// outputs if logLevel === 'warn' || 'all'
log.warn('WARN:', 'warn message')
// make a message greyed out
log.annotate('Annotate this message')changelog
v0.0.3
log.error now converts errors for better logging