New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

lg

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lg

logger class based on rule-functions. uses the console, a file and trigger an event for more complex action.

latest
npmnpm
Version
0.5.0
Version published
Weekly downloads
8
14.29%
Maintainers
1
Weekly downloads
 
Created
Source

lg

is a super simple logger class for nodeJS. It's part of the VisualWeb Framework (currently not public). it will log to the console, a (mongoDB) database, a file. just pass the configuration options when instantiating a new logger and there you go.

	Logger = require('logger');

	var log = new Logger(
		{
			log2console:true,
			rules: {
				minLogLevel: function(config, logTarget, content, sender, logLevel) {
					if (logLevel < 2) return false;
					return true;
				}
			}
		}, 
		function(loggerInstance) { 
			// if you chose log2database, you will need to wait for the
			// callback to be able to actually log... 
		} 
	);

	log.add('this is a message', 'cyan', 'byTest', 2);

Loglevels:

error (1):

	myLogger.error('Test ERROR message.', 'red', 'examples');

warn (2):

	myLogger.warn('Test WARN message.', 'yellow', 'examples');

info (3):

	myLogger.info('Test INFO message.', 'green', 'examples');

debug (4):

	myLogger.debug('Test DEBUG message.', 'blink', 'examples');

trace (5):

	myLogger.trace('Test TRACE message.', 'white', 'examples');

If you are not sure how to use these loglevels, here is a nice description.

Keywords

logging

FAQs

Package last updated on 10 May 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