JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 466
  • Score
    100M100P100Q87753F
  • License AGPL-3.0

enhanced console.log

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

html-docs

NPM version Linux Build Status Windows Build Status Coverage Status Greenkeeper badge Known Vulnerabilities

installation:

  npm install @magic/log

usage:

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