Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ee-log

Package Overview
Dependencies
Maintainers
1
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ee-log

simple, helpful & colorful logs

  • 0.3.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6.1K
decreased by-33.08%
Maintainers
1
Weekly downloads
 
Created
Source

ee-log

colorful, nice formatted logs for node.js

ATTENTION: this library should only be used when developing - it makes use of the sysnchronous logging funtionality ( like console.log itself ). you should never use synchronous logging in a live environment, it will slow down your application heavily! The library will be updated soon with asynchronous logging support for live applicaions.

installation

npm install ee-log

build status

Build Status

usage

var log = require( "ee-log" );

debug

prints grey text

log.debug( "debug %s ==> %s", 1, new Buffer( "whoa!" ), { go: "is a cool language!"} );

// output: 
22 13:06:34.935 > test.js:6, Object.<anonymous>                 >>> debug 1 ==> 77 68 6f 61 21 
{
    go: "is a cool language!"
}

info

prints white text

log.info( "info" );

// output
22 13:06:34.939 > test.js:7, Object.<anonymous>                 >>> info

warn

prints yellow text

log.warn( "warn", new Date(), 455 );

// output 
22 13:06:34.940 > test.js:8, Object.<anonymous>                 >>> warn, 2013-08-22T11:06:34.939Z, 455

error

prints red text

log.error( "error", { "test": 3 } );

// output
22 13:06:34.940 > test.js:9, Object.<anonymous>                 >>> error

highlight

prints cyan text

log.highlight( "highlight" );

// output
22 13:06:34.940 > test.js:10, Object.<anonymous>                >>> highlight

dir

prints the items passed to it

log.dir( { hi: 1 } );

// output
22 13:16:32.207 > test.js:11, Object.<anonymous>                >>> Dir
{
    hi: 1
}

trace

prints a colorful error stack trace

log.trace( new Error( "testing the sh*t" ) );

// output
22 13:30:48.899 > /test.js:12, Object.<anonymous>                >>> Trace
--------------------------------------------------------------------------------
Error: testing the sh*t
--------------------------------------------------------------------------------
                      /test.js   12:13  Object.<anonymous>
                     module.js  456:26  Module._compile
                     module.js  474:10  Object.Module._extensions..js
                     module.js  356:32  Module.load
                     module.js  312:12  Function.Module._load
                     module.js  497:10  Function.Module.runMain
                       node.js  119:16  startup
                       node.js  901:3   
--------------------------------------------------------------------------------

log method

prints whatever comes, uses log.info for text types

log( 2, "er %s:%s", 22, new Error( "whoa!" ), "hui", new Error( "" ), new Buffer(22) );

// output
23 14:53:15.480 > /test.js 16:2, Object.<anonymous>               >>> 2
23 14:53:15.480 > /test.js 16:2, Object.<anonymous>               >>> er 22:Error: whoa!
23 14:53:15.480 > /test.js 16:2, Object.<anonymous>               >>> hui
23 14:53:15.482 > /test.js 16:2, Object.<anonymous>               >>> [Trace]
--------------------------------------------------------------------------------
Error: -
--------------------------------------------------------------------------------
                      /test.js   16:55  Object.<anonymous>
                     module.js  456:26  Module._compile
                     module.js  474:10  Object.Module._extensions..js
                     module.js  356:32  Module.load
                     module.js  312:12  Function.Module._load
                     module.js  497:10  Function.Module.runMain
                       node.js  119:16  startup
                       node.js  901:3   
--------------------------------------------------------------------------------
23 14:53:15.482 > /test.js 16:2, Object.<anonymous>               >>> 70 ab ac 0 0 0 0 0 3a 0 0 0 3b 0 0 0 f0 34 72 1 0 0 

disable logging inside one module

// call this from inside your module, no logs will be displayed anymore
log.disable();

// enable logging again
log.enable();

Keywords

FAQs

Package last updated on 18 Dec 2014

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc