UNPKG

1.23 kBJavaScriptView Raw
1"use strict";
2var logger = require('tracer').colorConsole();
3logger.log('hello');
4logger.trace('hello', 'world');
5logger.debug('hello %s', 'world', 123);
6logger.info('hello %s %d', 'world', 123, {foo:'bar'});
7logger.warn('hello %s %d %j', 'world', 123, {foo:'bar'});
8logger.error('hello %s %d %j', 'world', 123, {foo:'bar'}, [1, 2, 3, 4], Object);
9logger.fatal('hello %s %d %j', 'world', 123, {foo:'bar'}, [1, 2, 3, 4], Object);
10
11//$ node example/colorConsole.js
12//2012-03-02T13:43:09.27Z <log> colorConsole.js:3 (Object.<anonymous>) hello
13//2012-03-02T13:43:09.29Z <trace> colorConsole.js:4 (Object.<anonymous>) hello world
14//2012-03-02T13:43:09.29Z <debug> colorConsole.js:5 (Object.<anonymous>) hello world 123
15//2012-03-02T13:43:09.29Z <info> colorConsole.js:6 (Object.<anonymous>) hello world 123 { foo: 'bar' }
16//2012-03-02T13:43:09.29Z <warn> colorConsole.js:7 (Object.<anonymous>) hello world 123 {"foo":"bar"}
17//2012-03-02T13:43:09.29Z <error> colorConsole.js:8 (Object.<anonymous>) hello world 123 {"foo":"bar"} [ 1, 2, 3, 4 ] function Object() { [native code] }
18//2012-03-02T13:43:09.29Z <fatal> colorConsole.js:8 (Object.<anonymous>) hello world 123 {"foo":"bar"} [ 1, 2, 3, 4 ] function Object() { [native code] }