0.4.3 • Published 11 years ago
graceful-logger v0.4.3
Graceful-Logger
A simple, slim, graceful logger for Nodejs
Capture

Example
logger = require('../lib')
logger.info('Hello', 'World!')
logger.warn({a: 'a', b: 'b'})
logger.err(-> "This is a function")
logger.format('medium')
logger.info('Hello', 'World!')
logger.warn({a: 'a', b: 'b'})
logger.err(-> "This is a function")
# Other features
## Output multi lines
logger.info '''
This is a multi line message:
Hello everyone.
Have a nice day!
'''
## Output required package
logger.info require('path')
## Output empty message
logger.info()
## Define any colors
logger.format ':level.blue :msg.grey'
logger.info('hello world')
## Use the numeric placeholder
logger.format ':level :0.grey :1.blue'
logger.info('hello', 'world')Benchmark
Console x 5,367 ops/sec ±2.96% (89 runs sampled) # console.log
Log x 5,556 ops/sec ±1.76% (93 runs sampled) # The tiny log module written by tj
Logger x 5,612 ops/sec ±0.95% (96 runs sampled) # This module
Fastest is Logger,Log,ConsoleChangeLog
0.4.0
- Remove multi-line prefix (v0.3.1) for the sake of efficiency
- User can define any color of the message by
.(color)format, but it only works after the:(label)expression, e.g.:level.green :msg.grey - The
:msgflag now support numbers for express the message of the correct index, e.g.:1.green :2.grey, and you will get an green 'hello' and a grey 'world' by usinglogger.info('hello', 'world'). Remember, the index start from 0.
0.3.2
- User can redefine
colorandlevelprefix by set thecolorandlevelproperty of each method.
0.3.1
- Add prefix to each line when messages have multi lines.
0.3.0
- Write message to process.stdout or process.stderr stream
- Use
util.formatto format object/function/array etc, as the same ofconsole.log - Add
setStreamandgetStreamtoget/setwritable stream of each method - Add
erroras alias oferr,warningas alias ofwarn
0.2.1
- Move exit feature from logger.err to logger.exit
0.2.0
- Use meanful tags such as :date, :level, etc...
- Remove custom prefix
- Use JSON.stringify to output objects
License
MIT
0.4.3
11 years ago
0.4.2
11 years ago
0.4.1
11 years ago
0.4.0
11 years ago
0.3.2
12 years ago
0.3.1
12 years ago
0.3.0
12 years ago
0.2.5
12 years ago
0.2.4
12 years ago
0.2.3
12 years ago
0.2.2
12 years ago
0.2.1
12 years ago
0.2.0
12 years ago
0.1.6
12 years ago
0.1.5
12 years ago
0.1.4
12 years ago
0.1.2
12 years ago
0.1.0
12 years ago
0.0.4
12 years ago
0.0.3
12 years ago
0.0.2
12 years ago
0.0.1
12 years ago
