Package Exports
- stupid-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 (stupid-log) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Logging utility for Node.js/io.js. Logs to stderr.
Designed to be as simple as possible. No:
- dependencies;
- log level control;
- colors;
- log servers.
Supports:
- named logs;
- four levels: default, warn, error, TODO.
Installation
$ npm install stupid-logUsage
Top-level log:
var log = require('stupid-log');
log('obj:', { x: 1 });
// obj: { x: 1 }
log.warn('obj:', { x: 1 });
// {WARN} obj: { x: 1 }
log.error('obj:', { x: 1 });
// {ERROR} obj: { x: 1 }
log.TODO('handle this case properly');
// {TODO} handle this case properlyNamed log:
var log = require('stupid-log').for('component');
log('obj:', { x: 1 });
// [component] obj: { x: 1 }
log.warn('obj:', { x: 1 });
// [component] {WARN} obj: { x: 1 }
log.error('obj:', { x: 1 });
// [component] {ERROR} obj: { x: 1 }
log.TODO('handle this case properly');
// [component] {TODO} handle this case properlyAs separate functions (ES6 syntax):
const log = require('stupid-log').for('component'),
{warn, error, TODO} = log;
log('obj:', { x: 1 });
warn('obj:', { x: 1 });
error('obj:', { x: 1 });
TODO('handle this case properly');