Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sbsoftware/node-basic-logger
basic logger for nodejs supporting error, warning, debug and info messages with timestamp.
https://github.com/sbsoftware/node-basic-logger
Last synced: about 1 month ago
JSON representation
basic logger for nodejs supporting error, warning, debug and info messages with timestamp.
- Host: GitHub
- URL: https://github.com/sbsoftware/node-basic-logger
- Owner: sbsoftware
- License: mit
- Created: 2011-12-21T22:04:47.000Z (about 13 years ago)
- Default Branch: master
- Last Pushed: 2014-08-04T20:47:23.000Z (over 10 years ago)
- Last Synced: 2024-10-25T01:26:25.292Z (3 months ago)
- Language: JavaScript
- Homepage:
- Size: 126 KB
- Stars: 2
- Watchers: 4
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Basic-Logger
============Basic logger for nodejs supporting error, warning, info, debug and trace messages with (or without) timestamp.
Everything you log is printed to the console.Installation
------------npm install basic-logger
Usage
-----var Logger = require('basic-logger');
// configure level one time, it will be set to every instance of the logger
Logger.setLevel('warning'); // only warnings and errors will be shown
Logger.setLevel('warning', true); // only warnings and errors will be shown and no message about the level change will be printedvar customConfig = {
showMillis: true;
showTimestamp: true;
};var log = new Logger(customConfig) // custom config parameters will be used, defaults will be used for the other parameters
log.error('An error occurred');
log.warn('I am not kidding!');
log.info('you just screwed this');
log.debug('this code is still alive...');
log.trace('we are here.');
Config options
--------------* `showTimestamp` - Show the timestamp with every message.
* `showMillis` - Show milliseconds in the timestamp.
* `printObjFunc` - The function to apply objects to, if logged. Default is util.inspect.
* `prefix` - String that is prepended to every message logged with this instance.Test
----You'll need `vows`. Then just run `npm test`.
Future versions
---------------* support for colored log messages
* log to file