1 | # tracer for node.js
|
2 |
|
3 | [![NPM version](http://img.shields.io/npm/v/tracer.svg)](https://www.npmjs.org/package/tracer)
|
4 | [![Dependency Status](https://david-dm.org/baryon/tracer.svg)](https://david-dm.org/baryon/tracer)
|
5 | [![devDependency Status](https://david-dm.org/baryon/tracer/dev-status.svg)](https://david-dm.org/baryon/tracer#info=devDependencies)
|
6 | [![Build Status](https://secure.travis-ci.org/baryon/tracer.png)](http://travis-ci.org/baryon/tracer)
|
7 |
|
8 | A powerful and customizable logging library for node.js.
|
9 |
|
10 | ===========
|
11 |
|
12 | ## Features
|
13 |
|
14 | ---
|
15 |
|
16 | - print log messages with timestamp, file name, method name, line number, path or call stack
|
17 | - be customized output format with micro-template and timestamp format
|
18 | - support user-defined logging levels
|
19 | - add easily any transport
|
20 | - support filter functions, so print statements in full color and font (color console)
|
21 |
|
22 | ## Install
|
23 |
|
24 | ---
|
25 |
|
26 | ```javascript
|
27 | npm install tracer --save
|
28 | ```
|
29 |
|
30 | ## Usage
|
31 |
|
32 | Add to your code:
|
33 |
|
34 | Simple Console
|
35 |
|
36 | ```javascript
|
37 | var logger = require('tracer').console()
|
38 | ```
|
39 |
|
40 | Color Console
|
41 |
|
42 | ```javascript
|
43 | var logger = require('tracer').colorConsole()
|
44 | ```
|
45 |
|
46 | Set Output Level
|
47 |
|
48 | ```javascript
|
49 | var logger = require('tracer').colorConsole({ level: 'warn' })
|
50 | ```
|
51 |
|
52 | ## Simple Example
|
53 |
|
54 | ### Simple Console
|
55 |
|
56 | ```javascript
|
57 | var logger = require('tracer').console();
|
58 |
|
59 | logger.log('hello');
|
60 | logger.trace('hello', 'world');
|
61 | logger.debug('hello %s', 'world', 123);
|
62 | logger.info('hello %s %d', 'world', 123, {foo:'bar'});
|
63 | logger.warn('hello %s %d %j', 'world', 123, {foo:'bar'});
|
64 | logger.error('hello %s %d %j', 'world', 123, {foo:'bar'}, [1, 2, 3, 4], Object);
|
65 |
|
66 | $ node example/console.js
|
67 | 2012-03-02T13:35:22.83Z <log> console.js:3 (Object.<anonymous>) hello
|
68 | 2012-03-02T13:35:22.85Z <trace> console.js:4 (Object.<anonymous>) hello world
|
69 | 2012-03-02T13:35:22.85Z <debug> console.js:5 (Object.<anonymous>) hello world 123
|
70 | 2012-03-02T13:35:22.85Z <info> console.js:6 (Object.<anonymous>) hello world 123 { foo: 'bar' }
|
71 | 2012-03-02T13:35:22.85Z <warn> console.js:7 (Object.<anonymous>) hello world 123 {"foo":"bar"}
|
72 | 2012-03-02T13:35:22.85Z <error> console.js:8 (Object.<anonymous>) hello world 123 {"foo":"bar"} [ 1, 2, 3, 4 ] function Object() { [native code] }
|
73 | ```
|
74 |
|
75 | ### Color Console
|
76 |
|
77 | ```javascript
|
78 | var logger = require('tracer').colorConsole()
|
79 |
|
80 | logger.log('hello')
|
81 | logger.trace('hello', 'world')
|
82 | logger.debug('hello %s', 'world', 123)
|
83 | logger.info('hello %s %d', 'world', 123, { foo: 'bar' })
|
84 | logger.warn('hello %s %d %j', 'world', 123, { foo: 'bar' })
|
85 | logger.error(
|
86 | 'hello %s %d %j',
|
87 | 'world',
|
88 | 123,
|
89 | { foo: 'bar' },
|
90 | [1, 2, 3, 4],
|
91 | Object
|
92 | )
|
93 | ```
|
94 |
|
95 | ### Daily Log
|
96 |
|
97 | ```javascript
|
98 | var logger = require('tracer').dailyfile({
|
99 | root: '.',
|
100 | maxLogFiles: 10,
|
101 | allLogsFileName: 'myAppName'
|
102 | })
|
103 |
|
104 | logger.log('hello')
|
105 | logger.trace('hello', 'world')
|
106 | logger.debug('hello %s', 'world', 123)
|
107 | logger.info('hello %s %d', 'world', 123, { foo: 'bar' })
|
108 | logger.warn('hello %s %d %j', 'world', 123, { foo: 'bar' })
|
109 | logger.error(
|
110 | 'hello %s %d %j',
|
111 | 'world',
|
112 | 123,
|
113 | { foo: 'bar' },
|
114 | [1, 2, 3, 4],
|
115 | Object
|
116 | )
|
117 | ```
|
118 |
|
119 | > dailylog will output all types log to diff files every day like log4j and if we provide allLogsFileName then all logs
|
120 | > will be move to that file too.
|
121 |
|
122 | ## Advanced Example
|
123 |
|
124 | some helper package is need, so install -dev for running examples
|
125 |
|
126 | ```javascript
|
127 | npm install -dev tracer
|
128 | ```
|
129 |
|
130 | Take a look at the examples directory for different examples.
|
131 |
|
132 | ### Set logging level
|
133 |
|
134 | the level option support index (number) or method name.
|
135 |
|
136 | ```javascript
|
137 | var logger = require('tracer').console({ level: 'warn' })
|
138 | ```
|
139 |
|
140 | equal
|
141 |
|
142 | ```javascript
|
143 | var logger = require('tracer').console({ level: 4 })
|
144 | ```
|
145 |
|
146 | ```javascript
|
147 | var logger = require('tracer').console({ level: 'warn' })
|
148 | logger.log('hello')
|
149 | logger.trace('hello', 'world')
|
150 | logger.debug('hello %s', 'world', 123)
|
151 | logger.info('hello %s %d', 'world', 123, { foo: 'bar' })
|
152 | logger.warn('hello %s %d %j', 'world', 123, { foo: 'bar' })
|
153 | logger.error(
|
154 | 'hello %s %d %j',
|
155 | 'world',
|
156 | 123,
|
157 | { foo: 'bar' },
|
158 | [1, 2, 3, 4],
|
159 | Object
|
160 | )
|
161 |
|
162 | //$ node example/level.js
|
163 | //2012-03-02T13:41:33.29Z <warn> level.js:6 (Object.<anonymous>) hello world 123 {"foo":"bar"}
|
164 | //2012-03-02T13:41:33.30Z <error> level.js:7 (Object.<anonymous>) hello world 123 {"foo":"bar"} [ 1, 2, 3, 4 ] function Object() { [native code] }
|
165 |
|
166 | //log,trace, debug and info level was not ouputed
|
167 | ```
|
168 |
|
169 | ### Customize output format
|
170 |
|
171 | format tag:
|
172 |
|
173 | - timestamp: current time
|
174 | - title: method name, default is 'log', 'trace', 'debug', 'info', 'warn', 'error','fatal'
|
175 | - level: method level, default is 'log':0, 'trace':1, 'debug':2, 'info':3, 'warn':4, 'error':5, 'fatal':6
|
176 | - message: printf message, support %s string, %d number, %j JSON and auto inspect
|
177 | - file: file name
|
178 | - line: line number
|
179 | - pos: position
|
180 | - path: file's path
|
181 | - folder: file's parent folder
|
182 | - method: method name of caller
|
183 | - stack: call stack message
|
184 |
|
185 | we use tinytim micro-template system to output log. see details [tinytim](https://github.com/baryon/node-tinytim).
|
186 | and, we use [Date Format](http://blog.stevenlevithan.com/archives/date-time-format) to format datetime.
|
187 |
|
188 | ```javascript
|
189 | var logger = require('tracer').console({
|
190 | format: '{{timestamp}} <{{title}}> {{message}} (in {{file}}:{{line}})',
|
191 | dateformat: 'HH:MM:ss.L'
|
192 | })
|
193 | ```
|
194 |
|
195 | Or, you can set special format for output method
|
196 |
|
197 | ```javascript
|
198 | var logger = require('tracer').colorConsole({
|
199 | format: [
|
200 | '{{timestamp}} <{{title}}> {{message}} (in {{file}}:{{line}})', //default format
|
201 | {
|
202 | error:
|
203 | '{{timestamp}} <{{title}}> {{message}} (in {{file}}:{{line}})\nCall Stack:\n{{stack}}' // error format
|
204 | }
|
205 | ],
|
206 | dateformat: 'HH:MM:ss.L',
|
207 | preprocess: function(data) {
|
208 | data.title = data.title.toUpperCase()
|
209 | }
|
210 | })
|
211 | ```
|
212 |
|
213 | the preprocess method is a choice for changing tag.
|
214 |
|
215 | ### Customize output methods
|
216 |
|
217 | ```javascript
|
218 | var colors = require('colors')
|
219 |
|
220 | var logger = require('tracer').colorConsole({
|
221 | level: 'log1',
|
222 | methods: ['log0', 'log1', 'log2', 'log3', 'log4', 'log5'],
|
223 | filters: [colors.underline, colors.yellow]
|
224 | })
|
225 | logger.log0('hello')
|
226 | logger.log1('hello', 'world')
|
227 | logger.log2('hello %s', 'world', 123)
|
228 | logger.log4('hello %s %d', 'world', 123)
|
229 | logger.log5('hello %s %d', 'world', 123)
|
230 | ```
|
231 |
|
232 | ### Customize filters
|
233 |
|
234 | each filtes function was called. the function is synchronous and must be like
|
235 |
|
236 | ```javascript
|
237 | function f1(str) {
|
238 | return str.toUpperCase()
|
239 | }
|
240 | ```
|
241 |
|
242 | About [Colors.js](https://github.com/Marak/colors.js)
|
243 |
|
244 | ```javascript
|
245 | var colors = require('colors')
|
246 | var logger = require('tracer').colorConsole({
|
247 | filters: [
|
248 | f1,
|
249 | colors.underline,
|
250 | colors.blue, //default filter
|
251 | //the last item can be custom filter. here is "warn" and "error" filter
|
252 | {
|
253 | warn: colors.yellow,
|
254 | error: [f1, colors.red, colors.bold]
|
255 | }
|
256 | ]
|
257 | })
|
258 | ```
|
259 |
|
260 | the filter support key-function pair, example: [color_console.js](https://github.com/baryon/tracer/blob/master/lib/color_console.js)
|
261 |
|
262 | ```javascript
|
263 | {
|
264 | filters : {
|
265 | //log : colors.black,
|
266 | trace : colors.magenta,
|
267 | debug : colors.blue,
|
268 | info : colors.green,
|
269 | warn : colors.yellow,
|
270 | error : [ colors.red, colors.bold ]
|
271 | }
|
272 | }
|
273 | ```
|
274 |
|
275 | and the filters is an array, the last item can be custom filter. see example:[filter.js](https://github.com/baryon/tracer/blob/master/example/filter.js)
|
276 |
|
277 | ### Log File Transport
|
278 |
|
279 | ```javascript
|
280 | var fs = require('fs')
|
281 |
|
282 | var logger = require('tracer').console({
|
283 | transport: function(data) {
|
284 | console.log(data.output)
|
285 | fs.appendFile('./file.log', data.rawoutput + '\n', err => {
|
286 | if (err) throw err
|
287 | })
|
288 | }
|
289 | })
|
290 |
|
291 | logger.log('hello')
|
292 | logger.trace('hello', 'world')
|
293 | logger.debug('hello %s', 'world', 123)
|
294 | logger.info('hello %s %d', 'world', 123, { foo: 'bar' })
|
295 | logger.warn('hello %s %d %j', 'world', 123, { foo: 'bar' })
|
296 | logger.error(
|
297 | 'hello %s %d %j',
|
298 | 'world',
|
299 | 123,
|
300 | { foo: 'bar' },
|
301 | [1, 2, 3, 4],
|
302 | Object
|
303 | )
|
304 | ```
|
305 |
|
306 | ### Stream Transport
|
307 |
|
308 | ```javascript
|
309 | var fs = require('fs')
|
310 |
|
311 | var logger = require('tracer').console({
|
312 | transport: function(data) {
|
313 | console.log(data.output)
|
314 | var stream = fs
|
315 | .createWriteStream('./stream.log', {
|
316 | flags: 'a',
|
317 | encoding: 'utf8',
|
318 | mode: 0666
|
319 | })
|
320 | .write(data.rawoutput + '\n')
|
321 | }
|
322 | })
|
323 |
|
324 | logger.log('hello')
|
325 | logger.trace('hello', 'world')
|
326 | logger.debug('hello %s', 'world', 123)
|
327 | logger.info('hello %s %d', 'world', 123, { foo: 'bar' })
|
328 | logger.warn('hello %s %d %j', 'world', 123, { foo: 'bar' })
|
329 | logger.error(
|
330 | 'hello %s %d %j',
|
331 | 'world',
|
332 | 123,
|
333 | { foo: 'bar' },
|
334 | [1, 2, 3, 4],
|
335 | Object
|
336 | )
|
337 | ```
|
338 |
|
339 | ### MongoDB Transport
|
340 |
|
341 | ```javascript
|
342 | var mongo = require('mongoskin')
|
343 | var db = mongo.db('127.0.0.1:27017/test?auto_reconnect')
|
344 |
|
345 | var log_conf = {
|
346 | transport: function(data) {
|
347 | console.log(data.output)
|
348 | var loginfo = db.collection('loginfo')
|
349 | loginfo.insert(data, function(err, log) {
|
350 | if (err) {
|
351 | console.error(err)
|
352 | }
|
353 | })
|
354 | }
|
355 | }
|
356 |
|
357 | var logger = require('tracer').console(log_conf)
|
358 |
|
359 | logger.log('hello')
|
360 | logger.trace('hello', 'world')
|
361 | logger.debug('hello %s', 'world', 123)
|
362 | logger.info('hello %s %d', 'world', 123, { foo: 'bar' })
|
363 | logger.warn('hello %s %d %j', 'world', 123, { foo: 'bar' })
|
364 | logger.error(
|
365 | 'hello %s %d %j',
|
366 | 'world',
|
367 | 123,
|
368 | { foo: 'bar' },
|
369 | [1, 2, 3, 4],
|
370 | Object
|
371 | )
|
372 |
|
373 | console.log('\n\n\npress ctrl-c to exit')
|
374 | ```
|
375 |
|
376 | ### Defining Multiple Transport
|
377 |
|
378 | ```JavaScript
|
379 | var fs = require('fs');
|
380 | var logger = require('tracer').console({
|
381 | transport: [
|
382 | function (data) {
|
383 | fs.appendFile('./file.log', data.rawoutput + '\n', (err) => {
|
384 | if (err) throw err;
|
385 | });
|
386 | },
|
387 | function(data) {
|
388 | console.log(data.output);
|
389 | }
|
390 | ]
|
391 | });
|
392 | logger.log('hello');
|
393 | logger.trace('hello', 'world');
|
394 | logger.debug('hello %s', 'world', 123);
|
395 | logger.info('hello %s %d', 'world', 123, {foo: 'bar'});
|
396 | logger.warn('hello %s %d %j', 'world', 123, {foo: 'bar'});
|
397 | logger.error('hello %s %d %j', 'world', 123, {foo: 'bar'}, [1, 2, 3, 4], Object);
|
398 | ```
|
399 |
|
400 | ### Define your logging helper
|
401 |
|
402 | the work is like [color_console.js](https://github.com/baryon/tracer/blob/master/lib/color_console.js)
|
403 |
|
404 | ```javascript
|
405 | var colors = require('colors')
|
406 | module.exports = function(conf) {
|
407 | return require('./console')(
|
408 | {
|
409 | filters: {
|
410 | //log : colors.black,
|
411 | trace: colors.magenta,
|
412 | debug: colors.blue,
|
413 | info: colors.green,
|
414 | warn: colors.yellow,
|
415 | error: [colors.red, colors.bold]
|
416 | }
|
417 | },
|
418 | conf
|
419 | )
|
420 | }
|
421 | ```
|
422 |
|
423 | ### Customize output Object's properties
|
424 |
|
425 | ```javascript
|
426 | var obj = {
|
427 | Request: [
|
428 | {
|
429 | IsValid: ['True'],
|
430 | ItemSearchRequest: [
|
431 | {
|
432 | ResponseGroup: ['Small', 'OfferSummary'],
|
433 | Sort: ['salesrank'],
|
434 | SearchIndex: ['DVD']
|
435 | }
|
436 | ]
|
437 | }
|
438 | ]
|
439 | }
|
440 |
|
441 | var logger = require('tracer').console({
|
442 | inspectOpt: {
|
443 | showHidden: true, //the object's non-enumerable properties will be shown too
|
444 | depth: null //tells inspect how many times to recurse while formatting the object. This is useful for inspecting large complicated objects. Defaults to 2. To make it recurse indefinitely pass null.
|
445 | }
|
446 | })
|
447 | logger.log(obj)
|
448 |
|
449 | //
|
450 | // 2013-09-30T04:30:44.927Z <log> depth.js:26 (Object.<anonymous>) { Request:
|
451 | // [ { IsValid: [ 'True', [length]: 1 ],
|
452 | // ItemSearchRequest:
|
453 | // [ { ResponseGroup: [ 'Small', 'OfferSummary', [length]: 2 ],
|
454 | // Sort: [ 'salesrank', [length]: 1 ],
|
455 | // SearchIndex: [ 'DVD', [length]: 1 ] },
|
456 | // [length]: 1 ] },
|
457 | // [length]: 1 ] }
|
458 | ```
|
459 |
|
460 | ### Specify the stack index for file info
|
461 |
|
462 | Fix `file`, `path`, and `line` info width `stackIndex`.
|
463 | It is userful for development package.
|
464 |
|
465 | ```javascript
|
466 | var logger = require('tracer').console({
|
467 | stackIndex: 0 // default 0
|
468 | })
|
469 | var logger2 = require('tracer').console({
|
470 | stackIndex: 1
|
471 | })
|
472 | var logMgr = function(type, msg) {
|
473 | return logger[type](msg)
|
474 | }
|
475 | var logMgr2 = function(type, msg) {
|
476 | return logger2[type](msg)
|
477 | }
|
478 |
|
479 | logger.log('hello') // the line info is right
|
480 | logger2.log('hello') // the line info is error
|
481 | logMgr('log', 'hello') // the line info is error
|
482 | logMgr2('log', 'hello') // the line info is right
|
483 | ```
|
484 |
|
485 | ### setLevel and close
|
486 |
|
487 | setLevel and close methods to dynamically change the log level.
|
488 | these are global settings, affect all output that are created via tracer
|
489 |
|
490 | ```javascript
|
491 | var tracer = require('tracer')
|
492 | tracer.setLevel(2) //or tracer.setLevel('debug');
|
493 | //... ...
|
494 | tracer.close()
|
495 | ```
|
496 |
|
497 | notice:
|
498 | if you set level in initialize, you can't change more lower level than the initial level.
|
499 |
|
500 | ```javascript
|
501 | var tracer = require('tracer')
|
502 | var logger = tracer.console({ level: 'warn' })
|
503 |
|
504 | logger.log('hello') //nothing output
|
505 |
|
506 | tracer.setLevel(0) //dont work.
|
507 | logger.log('hello') //nothing output
|
508 |
|
509 | tracer.setLevel('error') //it works.
|
510 | logger.warn('hello') //nothing output
|
511 |
|
512 | logger.error('hello') //'hello'
|
513 | ```
|
514 |
|
515 | Read examples please. [setLevel.js](https://github.com/baryon/tracer/blob/master/example/setLevel.js)
|
516 |
|
517 | ### support console methods
|
518 |
|
519 | support count, assert and table methods.
|
520 | Read examples please. [consoleMethods.js](https://github.com/baryon/tracer/blob/master/example/consoleMethods.js)
|
521 |
|
522 | More features, please read examples.
|
523 |
|
524 | ## History
|
525 |
|
526 | ### 1.1.0
|
527 | - Updated map tracer.warn to console.warn. Thanks @eouia
|
528 | - Fixed webpack warning "Critical dependency: the request of a dependency is an expression". Thanks @tjr
|
529 | - Fixed Move nyc from dependencies to devDependencies. Thanks @madarche
|
530 |
|
531 | ### 1.0.3
|
532 | - Updated some packages to the latest version. Fixed severity vulnerability
|
533 |
|
534 | ### 1.0.2
|
535 |
|
536 | - Updated some packages to the latest version
|
537 | - Released
|
538 |
|
539 | ### 0.9.9
|
540 |
|
541 | - Fixed. Port tests from expresso to mocha. Fixes #105 #106 by @ossdev07.
|
542 | - Fixed. Update type definitions to be able to use array in filters. #104 by @irisked.
|
543 | - Fixed potential security vulnerabilities in your dependencies in istanbul package.
|
544 |
|
545 | ### 0.9.8
|
546 |
|
547 | - Added. {{folder}} template option for parent folder. #96 by @shbatm.
|
548 | - Added. rootDir param option for folder. #99 by @nswbmw. sample: folder.js and folder2.js
|
549 |
|
550 | ### 0.9.5
|
551 |
|
552 | - Fixed. Update index.d.ts and dtslint for typescript. #92 and #94 by @Diluka.
|
553 |
|
554 | ### 0.9.3
|
555 |
|
556 | - Fixed. Any custom keys for typescript. #90 by @Diluka.
|
557 | - Updated formatJson sample
|
558 |
|
559 | ### 0.9.2
|
560 |
|
561 | - Fixed. Make type definitions correct & add comments. #89 by @plylrnsdy.
|
562 | - Updated npm packages
|
563 |
|
564 | ### 0.9.1
|
565 |
|
566 | - Fixed. transport function parameter data type is LogOutput not string #87 by @myfjdthink.
|
567 |
|
568 | ### 0.9.0
|
569 |
|
570 | - Added support all console methods, include count,assert and table. a new option 'supportConsoleMethods' is true default. example: consoleMethods.js in example folder.
|
571 |
|
572 | ### 0.8.15
|
573 |
|
574 | - Adding type definitions #84 by @kobim
|
575 | - Added data.rawoutput #83 by @Royalgamer06
|
576 | - recommended linting #82 by @elomariAchraf
|
577 |
|
578 | ### 0.8.12
|
579 |
|
580 | - added the ability to load the config from a file. #80 thanks @muthursyamburi
|
581 | - fix a bug for windows cant create dailyfile dir #77 by @moonrailgun
|
582 | - fixed. no fatal color in colorConsole missed. #79
|
583 |
|
584 | ### 0.8.11
|
585 |
|
586 | - added fatal level, like log4j. #75 thanks @ds3783
|
587 | - fixed double-log file issue. #71 thanks @huangts
|
588 | - and something missed
|
589 |
|
590 | ### 0.8.4-0.8.7
|
591 |
|
592 | - added some codes, details: #56 thanks @AmitThakkar
|
593 |
|
594 | ### 0.8.3
|
595 |
|
596 | - fixed: Got extra data in the log file. #45 thanks @JohnSmithDr
|
597 | - merged: Add Strict mode and EsLint from @HakmiSofian
|
598 | - merged: Change the log to file example to using `fs.appendFile()` instead. from @twang2218
|
599 | - merged: Enable use of tracer in strict mode from @madarche
|
600 | - merged: Added getter for log level from @ColRad
|
601 | - tested on node.js 4/5
|
602 |
|
603 | ### 0.8.2
|
604 |
|
605 | - added: Defining a field for max file days filea. #35 thanks @AmitThakkar
|
606 |
|
607 | ### 0.8.1
|
608 |
|
609 | - added: Adding support for Multiple Transports. #36 thanks @AmitThakkar
|
610 | - fixed: dailyfile auto create folder #37. thanks @klesh
|
611 |
|
612 | ### 0.8.0
|
613 |
|
614 | - added: setLevel method to dynamically change the log level. thanks @madarche, #30
|
615 | - added: close method to end all of the writable streams. thanks @loht, #31
|
616 |
|
617 | ### 0.7.4
|
618 |
|
619 | - fixed: use the lastest package of colors v1.0.3.
|
620 | - fixed: removed filter's second parameter
|
621 |
|
622 | ### 0.7.3
|
623 |
|
624 | - restored: use colors package replace cli-color, because some bugs and a lot of dependencies in cli-color. ref colorConsole2.js example.
|
625 |
|
626 | ### 0.7.2
|
627 |
|
628 | - fixed: change log dateformat from UTC to LOCAL iso format (Suggest by @felixhao28)
|
629 | - fixed: change color package from colors to cli-color (Suggest by @jeffreydwalter)
|
630 |
|
631 | ### 0.7.1
|
632 |
|
633 | - added: format add `%j` placeholder (Thanks @Bacra)
|
634 | - added: add stackIndex opt to specify the index of stack (Thanks @Bacra)
|
635 |
|
636 | ### 0.7.0
|
637 |
|
638 | - fixed: change inspect format, using new format of node.js 0.10. (Thanks @Bacra)
|
639 | - fixed: now support node.js 0.10 and above, NO Support 0.8 and 0.6
|
640 |
|
641 | ### 0.6.2
|
642 |
|
643 | - fixed: change stack from array to string, and fixed example2.js
|
644 |
|
645 | ### 0.6.1
|
646 |
|
647 | - fixed: get the filename correctly on windows. thanks Tom Carchrae
|
648 | - added: added missing repository field. thanks @madarche
|
649 |
|
650 | ### 0.6.0
|
651 |
|
652 | - feature: add showHidden and depth option for showing object's properties.
|
653 |
|
654 | ### 0.5.1
|
655 |
|
656 | - feature: add args into data object, now we can check args in preprocess, see example format2.js, merge from yasuyk04/work
|
657 |
|
658 | ### 0.5.0
|
659 |
|
660 | - performance: speed up when the format don't include method,path,line,pos,file, thanks sharonjl's issue report
|
661 |
|
662 | ### 0.4.2
|
663 |
|
664 | - fixed: debug color from blue to cyan
|
665 |
|
666 | ### 0.4.1
|
667 |
|
668 | - fixed: default timestamp is ISO UTC format.
|
669 |
|
670 | ### 0.4.0
|
671 |
|
672 | - feature: support dailyfile method, added some examples
|
673 | - feature: add preprocess custom method for changing tags before format
|
674 |
|
675 | ### 0.3.5
|
676 |
|
677 | - fixed bug: can't get method/line number in express
|
678 |
|
679 | ### 0.3.4
|
680 |
|
681 | - use [tinytim package](https://github.com/baryon/node-tinytim)
|
682 |
|
683 | ### 0.3.3
|
684 |
|
685 | - spell missing (transpot->transport)
|
686 |
|
687 | ### 0.3.2
|
688 |
|
689 | - speed-up for \_log function
|
690 | - add some test codes
|
691 |
|
692 | ### 0.3.1
|
693 |
|
694 | - minor-fix for call stack
|
695 |
|
696 | ### 0.3.0
|
697 |
|
698 | - support custom format and filter for special method
|
699 |
|
700 | ### 0.2.1
|
701 |
|
702 | - fix spell missing
|
703 |
|
704 | ### 0.2.0
|
705 |
|
706 | - Add more examples.
|
707 | - Default methods is log, trace, debug, info, warn, error.
|
708 | - Support 'string' level, {level:'warn'} equal {level:4}
|
709 |
|
710 | ### 0.1.0
|
711 |
|
712 | - Initial Tracer implementation.
|
713 |
|
714 | ## License
|
715 |
|
716 | (The MIT License)
|
717 |
|
718 | Copyright (c) 2012 LI Long <lilong@gmail.com>
|
719 |
|
720 | Permission is hereby granted, free of charge, to any person obtaining
|
721 | a copy of this software and associated documentation files (the
|
722 | 'Software'), to deal in the Software without restriction, including
|
723 | without limitation the rights to use, copy, modify, merge, publish,
|
724 | distribute, sublicense, and/or sell copies of the Software, and to
|
725 | permit persons to whom the Software is furnished to do so, subject to
|
726 | the following conditions:
|
727 |
|
728 | The above copyright notice and this permission notice shall be
|
729 | included in all copies or substantial portions of the Software.
|
730 |
|
731 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
732 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
733 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
734 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
735 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
736 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
737 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|