Socket
Book a DemoInstallSign in
Socket

yacon

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

yacon

Yet another colored console logger.

latest
Source
npmnpm
Version
1.0.1
Version published
Weekly downloads
4
Maintainers
1
Weekly downloads
 
Created
Source

yacon

This is yet another console logging / debugging module. It has the following features:

  • util.format() formatting.
  • Optional timestamping.
  • Optional call site printing.
  • Optional coloring.
  • Debug output can be enabled in code or via environment variable.

Functions

enableDebug()

Enables output of .debug() calls and adds callsite information to all lines. Can also be enabled by setting the environment variable DEBUG to anything.

enableTimestamps()

Enables output of ISO8601 timestamps at the start of every line. Can also be enabled by setting the environment variable DEBUG to timestamps.

debug(), ok(), info(), warning(), error(), fatal()

Output the arguments in the same way as util.format(), preceded by the specified level keyword. debug() will be silent unless debug output has been enabled. fatal() will never return.

Example

var con = require('./lib/yacon.js');

function main() {
    con.debug('Debug output: %j', {obj: {foo: 42}});
    con.ok('Good stuff');
    con.info('Informational');
    con.warning('Warning');
    con.error('Error');
    con.fatal('Fatal (program will exit)');
    con.info('We never get here');
}

main();

Example Output

License

MIT

FAQs

Package last updated on 09 Apr 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts