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

captains-log

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

captains-log

Simple wrapper around Winston to allow for declarative configuaration

  • 0.11.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
47K
decreased by-38.19%
Maintainers
1
Weekly downloads
 
Created
Source

captains-log

Simple wrapper around Winston to allow for declarative configuration

Default log levels

Based on npm's log levels

  • log.silly()
  • log.verbose()
  • log.info()
  • log.debug()
    • (npm calls this level log.http(), but we call it debug. If you use log(), the logger sees this as a call to log.debug())
  • log.warn()
  • log.error()
Custom Examples


/**
 * Using Winston
 * ====================================
 * 
 * Formerly, this module encapsulated Winston, a popular logger
 * by @indexzero and the gals/guys over at Nodejitsu.
 * Recently, we made Winston optional to make CaptainsLog as
 * lightweight as possible and reduce `npm install`/`require()`
 * for its usage in other modules.
 *
 * But Winston is awesome!  And it's a great fit for many apps,
 * giving you granular control over how log output is handled,
 * including sending emails, logging to multiple transports,
 * and other production-time concerns.
 *
 * More info/docs on Winston:
 * https://github.com/flatiron/winston
 * 
 * To use Winston w/ captains-log, do the following:

		var captains = CaptainsLog({
			custom: new (require('winston').Logger)({
				levels     : ...,
				transports : ...
			})
		});
 *
 */

/**
 *
 * Using your own custom logger
 * ====================================
 * 
 * To use a different library, `overrides.custom` must already
 * be instantiated and ready to go with (at minimum) an n-ary `.debug()`
 * method.  i.e. by n-ary, I mean that the following should
 * work (with any # of arguments):
	
		customLogger.debug()
		customLogger.debug('blah')
		customLogger.debug('blah', 'foo')
		customLogger.debug('blah', 'foo', {bar: 'baz'})
		customLogger.debug('blah', 'foo', {bar: 'baz'}, ['a', 3], 2, false);
		// etc.

		// To use a custom logged
		var captains = CaptainsLog({
			custom: customLogger
		});
 *
 */

Keywords

FAQs

Package last updated on 19 Jan 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