delog
v0.0.1
Published
Node Debug Logger
Downloads
4
Readme
delog
Node Debug Logger
installation
$ npm install delog
require
var delog = require('delog');
delog#enable
to enable call before creating delogger
delog.enable('beer');
delog#
outputs to stdout
var beer = delog('beer');
[delogger]#log
calls console.log
and outputs to stdout
beer('log', 'The fridge is working')
beer.log('The fridge is working');
[delogger]#warn
calls console.warn
and outputs to stderr
beer('warn', 'You might be out')
beer.warn('You might be out');
[delogger]#error
calls console.error
and outputs to stderr
beer('error', 'You are out!')
beer.error('You are out');
groups
var open = delog('tcp:open');
var close = delog('tcp:close');
delog.enable('tcp:open');
open('You have been logged');
open.warn('Your messages are logging');
close('this will not be logged');
close.error('Not enabled so not logged');
wildcards
var requests = delog('server:requests');
var response = delog('server:response');
delog.enable('server:*');
requests('got a request');
requests.warn('request came slow');
response('sent a response');
response.error('you didn't send anything');
examples
var delog = require('delog');
delog.enable('test:a');
var a = delog('test:a');
var b = delog('test:b');
console.log('test:a is Enabled');
a('Basic');
a('log','Log 1');
a.log('Log 2');
a.error('A: Error 1');
a('error', 'A: Error 2');
a.warn('A: Warn 1');
a('warn', 'A: Warn 2');
console.log('test:b is Disabled');
b('Basic');
b('log','Log 1');
b.log('Log 2');
b.error('b: Error 1');
b('error', 'b: Error 2');
b.warn('b: Warn 1');
b('warn', 'b: Warn 2');
License
(The MIT License)
Copyright (c) 2013 Christian Sullivan <[email protected]>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.