4.4.3 • Published 7 years ago

fm-log v4.4.3

Weekly downloads
33
License
MIT
Repository
github
Last release
7 years ago

fm-log

npm Package npm.io Coverage Status Code Climate GitHub license

What?

Straight-forward logging module.

  • lines up everything in nice columns
  • uses colors
  • sends everything straight to process.stderr (no events, no nextTick()) if desired
  • condenses repeated messages
  • displays stack traces for logged Error instances and other multi-line content nicely
  • optionally displays the source of the logging call
  • supports wrapping of morgan in your express app
  • can replace the debug module, using hartwig-at/debug

Example

var log = require( "fm-log" ).module( "demo" );

log.info( "Logging without source tracing" );
log.notice( "Initializing application...\nwow\nsuch application" );
log.critical( new Error( "Logging an Error instance." ) );

log.withSource();
log.info( "Logging WITH source tracing" );
log.notice( "You'll never know where this was logged from!" );

log = require( "fm-log" );
log.warn( "We don't need no prefix!" );

log = require( "fm-log" ).module( "something weird" );
log.warn( "...or do we?" );

log = require( "fm-log" );
log.notice( "You're using a longer prefix? I'll adjust." );

log = require( "fm-log" ).module();
log.error( "ouch" );

npm.io

// Wrap morgan
app.use( require( "fm-log" ).module( "HTTP" ).morgan( {format : "dev"} ) );

How?

Install

npm install fm-log

Put this in every file where you want to log:

var log = require( "fm-log" ).module();

Then just use log.info or one of the other logging levels shown above.

For loggers without a specific prefix, just require() the module and use it directly:

var generic = require( "fm-log" );
generic.notice( "We don't need no prefix" );

To log to a different stream (process.stdout is the default), use .to():

var logger = require( "fm-log" ).to( process.stderr );

To send data straight to the output stream (without nextTick()), use .sync():

var logger = require( "fm-log" ).sync();
4.4.3

7 years ago

4.4.2

7 years ago

4.4.1

8 years ago

4.4.0

8 years ago

4.3.0

8 years ago

4.2.1

8 years ago

4.2.0

8 years ago

4.1.0

8 years ago

4.0.3

8 years ago

4.0.2

8 years ago

4.0.1

8 years ago

4.0.0

8 years ago

4.0.0-rc0

8 years ago

3.1.0

8 years ago

3.0.0

8 years ago

2.0.0

8 years ago

1.1.0

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago

1.0.0-beta0

9 years ago

0.8.2

9 years ago

0.8.1

9 years ago

0.8.0

9 years ago

0.7.4

9 years ago

0.7.3

9 years ago

0.7.2

9 years ago

0.7.1

10 years ago

0.7.0

10 years ago

0.6.2

10 years ago

0.6.1

10 years ago

0.6.0

10 years ago

0.5.1

10 years ago

0.5.0

10 years ago

0.4.0

10 years ago

0.3.0

10 years ago

0.2.0

10 years ago

0.1.0

10 years ago

0.0.1

10 years ago