New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

fm-log

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fm-log

Console logging facility for Node

  • 1.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
43
increased by1333.33%
Maintainers
1
Weekly downloads
 
Created
Source

fm-log

Coverage Status Code Climate GitHub license

What?

Straight-forward logging module.

  • lines up everything in nice columns
  • uses colors
  • sends everything straight to process.stdout (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" );

// 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();

Keywords

FAQs

Package last updated on 05 Sep 2015

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