UNPKG

45.3 kBMarkdownView Raw
1# bunyan Changelog
2
3Known issues:
4
5- [issue #58] Can't install to a dir with spaces. This is [this node-gyp
6 bug](https://github.com/TooTallNate/node-gyp/issues/65).
7
8## not yet released
9
10(nothing yet)
11
12
13## 2.0.0 (beta)
14
15- [issue #499] Fix some `bunyan` CLI exit handling problems.
16
17
18## 1.8.10
19
20- Ensure that `bunyan` errors out if attempting to use `-p PID` and
21 file args at the same time.
22
23
24## 1.8.9
25
26- [pull #409, issue #246] Revert a change added to the `bunyan` CLI version
27 1.0.1 where `SIGINT` was ignored, such that Ctrl+C could not be used to
28 terminate bunyan. (By @zbjornson and @davepacheco.)
29- [pull #469] Fix a strict mode (`"use strict;"`) error in some versions of
30 Safari.
31
32
33## 1.8.8
34
35- Fix breakage due to a silly last minute "fix 'make check'".
36
37
38## 1.8.7
39
40Note: *Bad release.* Use 1.8.8 or later.
41
42- [issue #484] Fix breakage due to #474 in previous release.
43
44
45## 1.8.6
46
47Note: *Bad release.* Use 1.8.7 or later.
48
49- [issue #474] Bunyan's `safeCycles` is too slow when logging large objects.
50
51
52## 1.8.5
53
54- [issue #401] Improved performance when using disabled log levels.
55
56
57## 1.8.4
58
59- [issue #454] Fix `src` usage with node v7.
60
61
62## 1.8.3
63
64- [issue #450] Fix `log.info(null)` crash that resulted from #426 in v1.8.2.
65
66
67## 1.8.2
68
69- [issue #449] Bump dtrace-provider dep to 0.7.0 to help avoid deprecation
70 warnings with node v6 in some cases.
71- [issue #426] Ensure `log.info({err: err})` results in a "msg" value, just
72 like `log.info(err)`.
73
74
75## 1.8.1
76
77- [pull #386] Fix bad bug in rotation that could cause a crash with
78 error message "cannot start a rotation when already rotating"
79 (by Frankie O'Rourke). The bug was introduced in 1.8.0.
80
81
82## 1.8.0
83
84Note: *Bad release.* An addition in this release broke 'rotating-file' usage.
85Use 1.8.1 or later.
86
87- [issue #370] Fix `bunyan -p ...` (i.e. DTrace integration) on node
88 4.x and 5.x.
89- [issue #329, pull #330] Update the 'rotating-file' stream to do a file
90 rotation on initialization if the mtime on the file path indicates the
91 last rotation time was missed -- i.e. if the app wasn't running at the
92 time. (by Paul Milham.)
93
94
95## 1.7.1
96
97- [issue #332, pull #355] Ensure stream for type='stream' stream is a writable
98 stream. (By Michael Nisi.)
99
100- [issue #344] Fix "rotating-file" Bunyan streams to not miss rotations when configured
101 for a period greater than approximately 25 days. Before this there was an issue
102 where periods greater than node.js's maximum `setTimeout` length would fail to rotate.
103 (By Martijn Schrage.)
104
105- [issue #234, pull #345] Improve `bunyan` CLI rendering of "res" field
106 HTTP responses to not show two blank lines for an empty body.
107 (By Michael Nisi.)
108
109
110## 1.7.0
111
112- [pull #311, #302, #310] Improve the runtime environment detection to fix
113 running under [NW.js](http://nwjs.io/). Contributions by Adam Lynch, Jeremy
114 Ruppel, and Aleksey Timchenko.
115
116- [pull #318] Add `reemitErrorEvents` optional boolean for streams added to a
117 Bunyan logger to control whether an "error" event on the stream will be
118 re-emitted on the `Logger` instance.
119
120 var log = bunyan.createLogger({
121 name: 'foo',
122 streams: [
123 {
124 type: 'raw',
125 stream: new MyCustomStream(),
126 reemitErrorEvents: true
127 }
128 ]
129 });
130
131 Before this change, "error" events were re-emitted on [`file`
132 streams](https://github.com/trentm/node-bunyan#stream-type-file) only. The new
133 behaviour is as follows:
134
135 - `reemitErrorEvents` not specified: `file` streams will re-emit error events
136 on the Logger instance.
137 - `reemitErrorEvents: true`: error events will be re-emitted on the Logger
138 for any stream with a `.on()` function -- which includes file streams,
139 process.stdout/stderr, and any object that inherits from EventEmitter.
140 - `reemitErrorEvents: false`: error events will not be re-emitted for any
141 streams.
142
143 Dev Note: Bunyan `Logger` objects don't currently have a `.close()` method
144 in which registered error event handlers can be *un*registered. That means
145 that a (presumably rare) situation where code adds dozens of Bunyan Logger
146 streams to, e.g. process.stdout, and with `reemitErrorEvents: true`, could
147 result in leaking Logger objects.
148
149 Original work for allowing "error" re-emitting on non-file streams is
150 by Marc Udoff in pull #318.
151
152
153## 1.6.0
154
155- [pull #304, issue #245] Use [Moment.js][momentjs.com] library to handle
156 `bunyan` CLI time formatting in some cases, especially to fix display of
157 local time. It is now required for local time formatting (i.e. `bunyan -L`
158 or `bunyan --time local`). (By David M. Lee.)
159
160- [pull #252] Fix errant `client_res={}` in `bunyan` CLI rendering, and avoid
161 extra newlines in `client_req` rendering in some cases. (By Thomas Heymann.)
162
163- [pull #291, issue #303] Fix `LOG.child(...)` to *not* override the "hostname"
164 field of the parent. A use case is when one manually sets "hostname" to
165 something other than `os.hostname()`. (By github.com/Cactusbone.)
166
167- [issue #325] Allow one to set `level: 0` in `createLogger` to turn on
168 logging for all levels. (Adapted from #336 by github.com/sometimesalready.)
169
170- Add guards (to `resolveLevel`) so that all "level" values are validated.
171 Before this, a bogus level like "foo" or -12 or `['some', 'array']` would
172 silently be accepted -- with undefined results.
173
174- Doc updates for #340 and #305.
175
176- Update `make test` to test against node 5, 4, 0.12 and 0.10.
177
178
179## 1.5.1
180
181- [issue #296] Fix `src: true`, which was broken in v1.5.0.
182
183
184## 1.5.0
185
186Note: *Bad release.* The addition of `'use strict';` broke Bunyan's `src: true`
187feature. Use 1.5.1 instead.
188
189- [pull #236, issue #231, issue #223] Fix strict mode in the browser.
190- [pull #282, issue #213] Fixes bunyan to work with webpack. By Denis Izmaylov.
191- [pull #294] Update to dtrace-provider 0.6 to fix with node 4.0 and io.js 3.0.
192- Dropped support for 0.8 (can't install deps easily anymore for running
193 test suite). Bump to a recent iojs version for testing.
194
195
196## 1.4.0
197
198(Bumping minor ver b/c I'm wary of dtrace-provider changes. :)
199
200- [issue #258, pull #259] Update to dtrace-provider 0.5 to fix
201 install and tests on recent io.js versions.
202- safe-json-stringify@1.0.3 changed output, breaking some tests. Fix those.
203
204
205## 1.3.6
206
207- [issue #244] Make `bunyan` defensive on `res.header=null`.
208
209
210## 1.3.5
211
212- [issue #233] Make `bunyan` defensive on res.header as a boolean.
213- [issue #242] Make `bunyan` defensive on err.stack not being a string.
214
215
216## 1.3.4
217
218- Allow `log.child(...)` to work even if the logger is a *sub-class*
219 of Bunyan's Logger class.
220- [issue #219] Hide 'source-map-support' require from browserify.
221- [issue #218] Reset `haveNonRawStreams` on `<logger>.addStream`.
222
223
224## 1.3.3
225
226- [pull #127] Update to dtrace-provider 0.4.0, which gives io.js 1.x support
227 for dtrace-y parts of Bunyan.
228
229
230## 1.3.2
231
232- [pull #182] Fallback to using the optional 'safe-json-stringify' module
233 if `JSON.stringify` throws -- possibly with an enumerable property
234 getter than throws. By Martin Gausby.
235
236
237## 1.3.1
238
239- Export `bunyan.RotatingFileStream` which is needed if one wants to
240 customize it. E.g. see issue #194.
241
242- [pull #122] Source Map support for caller line position for [the "src"
243 field](https://github.com/trentm/node-bunyan#src). This could be interesting
244 for [CoffeeScript](http://coffeescript.org/documentation/docs/sourcemap.html)
245 users of Bunyan. By Manuel Schneider.
246
247- [issue #164] Ensure a top-level `level` given in `bunyan.createLogger`
248 is *used* for given `streams`. For example, ensure that the following
249 results in the stream having a DEBUG level:
250
251 var log = bunyan.createLogger({
252 name: 'foo',
253 level: 'debug',
254 streams: [
255 {
256 path: '/var/tmp/foo.log'
257 }
258 ]
259 });
260
261 This was broken in the 1.0.1 release. Between that release and 1.3.0
262 the "/var/tmp/foo.log" stream would be at the INFO level (Bunyan's
263 default level).
264
265
266## 1.3.0
267
268- [issue #103] `bunyan -L` (or `bunyan --time local`) to show local time.
269 Bunyan log records store `time` in UTC time. Sometimes it is convenient
270 to display in local time.
271
272- [issue #205] Fix the "The Bunyan CLI crashed!" checking to properly warn of
273 the common failure case when `-c CONDITION` is being used.
274
275
276## 1.2.4
277
278- [issue #210] Export `bunyan.nameFromLevel` and `bunyan.levelFromName`. It can
279 be a pain for custom streams to have to reproduce that.
280
281- [issue #100] Gracefully handle the case of an unbound
282 `Logger.{info,debug,...}` being used for logging, e.g.:
283
284 myEmittingThing.on('data', log.info)
285
286 Before this change, bunyan would throw. Now it emits a warning to stderr
287 *once*, and then silently ignores those log attempts, e.g.:
288
289 bunyan usage error: /Users/trentm/tm/node-bunyan/foo.js:12: attempt to log with an unbound log method: `this` is: { _events: { data: [Function] } }
290
291
292## 1.2.3
293
294- [issue #184] Fix log rotation for rotation periods > ~25 days. Before this
295 change, a rotation period longer than this could hit [the maximum setTimeout
296 delay in node.js](https://github.com/joyent/node/issues/8656). By Daniel Juhl.
297
298
299## 1.2.2
300
301- Drop the guard that a bunyan Logger level must be between TRACE (10)
302 and FATAL (60), inclusive. This allows a trick of setting the level
303 to `FATAL + 1` to turn logging off. While the standard named log levels are
304 the golden path, then intention was not to get in the way of using
305 other level numbers.
306
307
308## 1.2.1
309
310- [issue #178, #181] Get at least dtrace-provider 0.3.1 for
311 optionalDependencies to get a fix for install with decoupled npm (e.g. with
312 homebrew's node and npm).
313
314
315## 1.2.0
316
317- [issue #157] Restore dtrace-provider as a dependency (in
318 "optionalDependencies").
319
320 Dtrace-provider version 0.3.0 add build sugar that should eliminate the
321 problems from older versions:
322 The build is not attempted on Linux and Windows. The build spew is
323 *not* emitted by default (use `V=1 npm install` to see it); instead a
324 short warning is emitted if the build fails.
325
326 Also, importantly, the new dtrace-provider fixes working with node
327 v0.11/0.12.
328
329
330## 1.1.3
331
332- [issue #165] Include extra `err` fields in `bunyan` CLI output. Before
333 this change only the fields part of the typical node.js error stack
334 (err.stack, err.message, err.name) would be emitted, even though
335 the Bunyan *library* would typically include err.code and err.signal
336 in the raw JSON log record.
337
338
339## 1.1.2
340
341- Fix a breakage in `log.info(err)` on a logger with no serializers.
342
343
344## 1.1.1
345
346Note: *Bad release.* It breaks `log.info(err)` on a logger with no serializers.
347Use version 1.1.2.
348
349- [pull #168] Fix handling of `log.info(err)` to use the `log` Logger's `err`
350 serializer if it has one, instead of always using the core Bunyan err
351 serializer. (By Mihai Tomescu.)
352
353
354## 1.1.0
355
356- [issue #162] Preliminary support for [browserify](http://browserify.org/).
357 See [the section in the README](../README.md#browserify).
358
359
360## 1.0.1
361
362- [issues #105, #138, #151] Export `<Logger>.addStream(...)` and
363 `<Logger>.addSerializers(...)` to be able to add them after Logger creation.
364 Thanks @andreineculau!
365
366- [issue #159] Fix bad handling in construtor guard intending to allow
367 creation without "new": `var log = Logger(...)`. Thanks @rmg!
368
369- [issue #156] Smaller install size via .npmignore file.
370
371- [issue #126, #161] Ignore SIGINT (Ctrl+C) when processing stdin. `...| bunyan`
372 should expect the preceding process in the pipeline to handle SIGINT. While
373 it is doing so, `bunyan` should continue to process any remaining output.
374 Thanks @timborodin and @jnordberg!
375
376- [issue #160] Stop using ANSI 'grey' in `bunyan` CLI output, because of the
377 problems that causes with Solarized Dark themes (see
378 <https://github.com/altercation/solarized/issues/220>).
379
380
381## 1.0.0
382
383- [issue #87] **Backward incompatible change to `-c CODE`** improving
384 performance by over 10x (good!), with a backward incompatible change to
385 semantics (unfortunate), and adding some sugar (good!).
386
387 The `-c CODE` implementation was changed to use a JS function for processing
388 rather than `vm.runInNewContext`. The latter was specatularly slow, so
389 won't be missed. Unfortunately this does mean a few semantic differences in
390 the `CODE`, the most noticeable of which is that **`this` is required to
391 access the object fields:**
392
393 # Bad. Works with bunyan 0.x but not 1.x.
394 $ bunyan -c 'pid === 123' foo.log
395 ...
396
397 # Good. Works with all versions of bunyan
398 $ bunyan -c 'this.pid === 123' foo.log
399 ...
400
401 The old behaviour of `-c` can be restored with the `BUNYAN_EXEC=vm`
402 environment variable:
403
404 $ BUNYAN_EXEC=vm bunyan -c 'pid === 123' foo.log
405 ...
406
407 Some sugar was also added: the TRACE, DEBUG, ... constants are defined, so
408 one can:
409
410 $ bunyan -c 'this.level >= ERROR && this.component === "http"' foo.log
411 ...
412
413 And example of the speed improvement on a 10 MiB log example:
414
415 $ time BUNYAN_EXEC=vm bunyan -c 'this.level === ERROR' big.log | cat >slow
416
417 real 0m6.349s
418 user 0m6.292s
419 sys 0m0.110s
420
421 $ time bunyan -c 'this.level === ERROR' big.log | cat >fast
422
423 real 0m0.333s
424 user 0m0.303s
425 sys 0m0.028s
426
427 The change was courtesy Patrick Mooney (https://github.com/pfmooney). Thanks!
428
429- Add `bunyan -0 ...` shortcut for `bunyan -o bunyan ...`.
430
431- [issue #135] **Backward incompatible.** Drop dtrace-provider even from
432 `optionalDependencies`. Dtrace-provider has proven a consistent barrier to
433 installing bunyan, because it is a binary dep. Even as an *optional* dep it
434 still caused confusion and install noise.
435
436 Users of Bunyan on dtrace-y platforms (SmartOS, Mac, Illumos, Solaris) will
437 need to manually `npm install dtrace-provider` themselves to get [Bunyan's
438 dtrace support](https://github.com/trentm/node-bunyan#runtime-log-snooping-via-dtrace)
439 to work. If not installed, bunyan should stub it out properly.
440
441
442
443## 0.23.1
444
445- [pull #125, pull #97, issue #73] Unref rotating-file timeout which was
446 preventing processes from exiting (by https://github.com/chakrit and
447 https://github.com/glenn-murray-bse). Note: this only fixes the issue
448 for node 0.10 and above.
449
450
451## 0.23.0
452
453- [issue #139] Fix `bunyan` crash on a log record with `res.header` that is an
454 object. A side effect of this improvement is that a record with `res.statusCode`
455 but no header info will render a response block, for example:
456
457 [2012-08-08T10:25:47.637Z] INFO: my-service/12859 on my-host: some message (...)
458 ...
459 --
460 HTTP/1.1 200 OK
461 --
462 ...
463
464- [pull #42] Fix `bunyan` crash on a log record with `req.headers` that is a *string*
465 (by https://github.com/aexmachina).
466
467- Drop node 0.6 support. I can't effectively `npm install` with a node 0.6
468 anymore.
469
470- [issue #85] Ensure logging a non-object/non-string doesn't throw (by
471 https://github.com/mhart). This changes fixes:
472
473 log.info(<bool>) # TypeError: Object.keys called on non-object
474 log.info(<function>) # "msg":"" (instead of wanted "msg":"[Function]")
475 log.info(<array>) # "msg":"" (instead of wanted "msg":util.format(<array>))
476
477
478## 0.22.3
479
480- Republish the same code to npm.
481
482
483## 0.22.2
484
485Note: Bad release. The published package in the npm registry got corrupted. Use 0.22.3 or later.
486
487- [issue #131] Allow `log.info(<number>)` and, most importantly, don't crash on that.
488
489- Update 'mv' optional dep to latest.
490
491
492## 0.22.1
493
494- [issue #111] Fix a crash when attempting to use `bunyan -p` on a platform without
495 dtrace.
496
497- [issue #101] Fix a crash in `bunyan` rendering a record with unexpected "res.headers".
498
499
500## 0.22.0
501
502- [issue #104] `log.reopenFileStreams()` convenience method to be used with external log
503 rotation.
504
505
506## 0.21.4
507
508- [issue #96] Fix `bunyan` to default to paging (with `less`) by default in node 0.10.0.
509 The intention has always been to default to paging for node >=0.8.
510
511
512## 0.21.3
513
514- [issue #90] Fix `bunyan -p '*'` breakage in version 0.21.2.
515
516
517## 0.21.2
518
519**Note: Bad release. The switchrate change below broke `bunyan -p '*'` usage
520(see issue #90). Use 0.21.3 or later.**
521
522- [issue #88] Should be able to efficiently combine "-l" with "-p *".
523
524- Avoid DTrace buffer filling up, e.g. like this:
525
526 $ bunyan -p 42241 > /tmp/all.log
527 dtrace: error on enabled probe ID 3 (ID 75795: bunyan42241:mod-87ea640:log-trace:log-trace): out of scratch space in action #1 at DIF offset 12
528 dtrace: error on enabled probe ID 3 (ID 75795: bunyan42241:mod-87ea640:log-trace:log-trace): out of scratch space in action #1 at DIF offset 12
529 dtrace: 138 drops on CPU 4
530 ...
531
532 From Bryan: "the DTrace buffer is filling up because the string size is so
533 large... by increasing the switchrate, you're increasing the rate at
534 which that buffer is emptied."
535
536
537## 0.21.1
538
539- [pull #83] Support rendering 'client_res' key in bunyan CLI (by
540 github.com/mcavage).
541
542
543## 0.21.0
544
545- 'make check' clean, 4-space indenting. No functional change here, just
546 lots of code change.
547- [issue #80, #82] Drop assert that broke using 'rotating-file' with
548 a default `period` (by github.com/ricardograca).
549
550
551## 0.20.0
552
553- [Slight backward incompatibility] Fix serializer bug introduced in 0.18.3
554 (see below) to only apply serializers to log records when appropriate.
555
556 This also makes a semantic change to custom serializers. Before this change
557 a serializer function was called for a log record key when that value was
558 truth-y. The semantic change is to call the serializer function as long
559 as the value is not `undefined`. That means that a serializer function
560 should handle falsey values such as `false` and `null`.
561
562- Update to latest 'mv' dep (required for rotating-file support) to support
563 node v0.10.0.
564
565
566## 0.19.0
567
568**WARNING**: This release includes a bug introduced in bunyan 0.18.3 (see
569below). Please upgrade to bunyan 0.20.0.
570
571- [Slight backward incompatibility] Change the default error serialization
572 (a.k.a. `bunyan.stdSerializers.err`) to *not* serialize all additional
573 attributes of the given error object. This is an open door to unsafe logging
574 and logging should always be safe. With this change, error serialization
575 will log these attributes: message, name, stack, code, signal. The latter
576 two are added because some core node APIs include those fields (e.g.
577 `child_process.exec`).
578
579 Concrete examples where this has hurt have been the "domain" change
580 necessitating 0.18.3 and a case where
581 [node-restify](https://github.com/mcavage/node-restify) uses an error object
582 as the response object. When logging the `err` and `res` in the same log
583 statement (common for restify audit logging), the `res.body` would be JSON
584 stringified as '[Circular]' as it had already been emitted for the `err` key.
585 This results in a WTF with the bunyan CLI because the `err.body` is not
586 rendered.
587
588 If you need the old behaviour back you will need to do this:
589
590 var bunyan = require('bunyan');
591 var errSkips = {
592 // Skip domain keys. `domain` especially can have huge objects that can
593 // OOM your app when trying to JSON.stringify.
594 domain: true,
595 domain_emitter: true,
596 domain_bound: true,
597 domain_thrown: true
598 };
599 bunyan.stdSerializers.err = function err(err) {
600 if (!err || !err.stack)
601 return err;
602 var obj = {
603 message: err.message,
604 name: err.name,
605 stack: getFullErrorStack(err)
606 }
607 Object.keys(err).forEach(function (k) {
608 if (err[k] !== undefined && !errSkips[k]) {
609 obj[k] = err[k];
610 }
611 });
612 return obj;
613 };
614
615- "long" and "bunyan" output formats for the CLI. `bunyan -o long` is the default
616 format, the same as before, just called "long" now instead of the cheesy "paul"
617 name. The "bunyan" output format is the same as "json-0", just with a more
618 convenient name.
619
620
621## 0.18.3
622
623**WARNING**: This release introduced a bug such that all serializers are
624applied to all log records even if the log record did not contain the key
625for that serializer. If a logger serializer function does not handle
626being given `undefined`, then you'll get warnings like this on stderr:
627
628 bunyan: ERROR: This should never happen. This is a bug in <https://github.com/trentm/node-bunyan> or in this application. Exception from "foo" Logger serializer: Error: ...
629 at Object.bunyan.createLogger.serializers.foo (.../myapp.js:20:15)
630 at Logger._applySerializers (.../lib/bunyan.js:644:46)
631 at Array.forEach (native)
632 at Logger._applySerializers (.../lib/bunyan.js:640:33)
633 ...
634
635and the following junk in written log records:
636
637 "foo":"(Error in Bunyan log "foo" serializer broke field. See stderr for details.)"
638
639Please upgrade to bunyan 0.20.0.
640
641
642- Change the `bunyan.stdSerializers.err` serializer for errors to *exclude*
643 [the "domain*" keys](http://nodejs.org/docs/latest/api/all.html#all_additions_to_error_objects).
644 `err.domain` will include its assigned members which can arbitrarily large
645 objects that are not intended for logging.
646
647- Make the "dtrace-provider" dependency optional. I hate to do this, but
648 installing bunyan on Windows is made very difficult with this as a required
649 dep. Even though "dtrace-provider" stubs out for non-dtrace-y platforms,
650 without a compiler and Python around, node-gyp just falls over.
651
652
653## 0.18.2
654
655- [pull #67] Remove debugging prints in rotating-file support.
656 (by github.com/chad3814).
657- Update to dtrace-provider@0.2.7.
658
659
660## 0.18.1
661
662- Get the `bunyan` CLI to **not** automatically page (i.e. pipe to `less`)
663 if stdin isn't a TTY, or if following dtrace probe output (via `-p PID`),
664 or if not given log file arguments.
665
666
667## 0.18.0
668
669- Automatic paging support in the `bunyan` CLI (similar to `git log` et al).
670 IOW, `bunyan` will open your pager (by default `less`) and pipe rendered
671 log output through it. A main benefit of this is getting colored logs with
672 a pager without the pain. Before you had to explicit use `--color` to tell
673 bunyan to color output when the output was not a TTY:
674
675 bunyan foo.log --color | less -R # before
676 bunyan foo.log # now
677
678 Disable with the `--no-pager` option or the `BUNYAN_NO_PAGER=1` environment
679 variable.
680
681 Limitations: Only supported for node >=0.8. Windows is not supported (at
682 least not yet).
683
684- Switch test suite to nodeunit (still using a node-tap'ish API via
685 a helper).
686
687
688## 0.17.0
689
690- [issue #33] Log rotation support:
691
692 var bunyan = require('bunyan');
693 var log = bunyan.createLogger({
694 name: 'myapp',
695 streams: [{
696 type: 'rotating-file',
697 path: '/var/log/myapp.log',
698 count: 7,
699 period: 'daily'
700 }]
701 });
702
703
704- Tweak to CLI default pretty output: don't special case "latency" field.
705 The special casing was perhaps nice, but less self-explanatory.
706 Before:
707
708 [2012-12-27T21:17:38.218Z] INFO: audit/45769 on myserver: handled: 200 (15ms, audit=true, bar=baz)
709 GET /foo
710 ...
711
712 After:
713
714 [2012-12-27T21:17:38.218Z] INFO: audit/45769 on myserver: handled: 200 (audit=true, bar=baz, latency=15)
715 GET /foo
716 ...
717
718- *Exit* CLI on EPIPE, otherwise we sit there useless processing a huge log
719 file with, e.g. `bunyan huge.log | head`.
720
721
722## 0.16.8
723
724- Guards on `-c CONDITION` usage to attempt to be more user friendly.
725 Bogus JS code will result in this:
726
727 $ bunyan portal.log -c 'this.req.username==boo@foo'
728 bunyan: error: illegal CONDITION code: SyntaxError: Unexpected token ILLEGAL
729 CONDITION script:
730 Object.prototype.TRACE = 10;
731 Object.prototype.DEBUG = 20;
732 Object.prototype.INFO = 30;
733 Object.prototype.WARN = 40;
734 Object.prototype.ERROR = 50;
735 Object.prototype.FATAL = 60;
736 this.req.username==boo@foo
737 Error:
738 SyntaxError: Unexpected token ILLEGAL
739 at new Script (vm.js:32:12)
740 at Function.Script.createScript (vm.js:48:10)
741 at parseArgv (/Users/trentm/tm/node-bunyan-0.x/bin/bunyan:465:27)
742 at main (/Users/trentm/tm/node-bunyan-0.x/bin/bunyan:1252:16)
743 at Object.<anonymous> (/Users/trentm/tm/node-bunyan-0.x/bin/bunyan:1330:3)
744 at Module._compile (module.js:449:26)
745 at Object.Module._extensions..js (module.js:467:10)
746 at Module.load (module.js:356:32)
747 at Function.Module._load (module.js:312:12)
748 at Module.runMain (module.js:492:10)
749
750 And all CONDITION scripts will be run against a minimal valid Bunyan
751 log record to ensure they properly guard against undefined values
752 (at least as much as can reasonably be checked). For example:
753
754 $ bunyan portal.log -c 'this.req.username=="bob"'
755 bunyan: error: CONDITION code cannot safely filter a minimal Bunyan log record
756 CONDITION script:
757 Object.prototype.TRACE = 10;
758 Object.prototype.DEBUG = 20;
759 Object.prototype.INFO = 30;
760 Object.prototype.WARN = 40;
761 Object.prototype.ERROR = 50;
762 Object.prototype.FATAL = 60;
763 this.req.username=="bob"
764 Minimal Bunyan log record:
765 {
766 "v": 0,
767 "level": 30,
768 "name": "name",
769 "hostname": "hostname",
770 "pid": 123,
771 "time": 1355514346206,
772 "msg": "msg"
773 }
774 Filter error:
775 TypeError: Cannot read property 'username' of undefined
776 at bunyan-condition-0:7:9
777 at Script.Object.keys.forEach.(anonymous function) [as runInNewContext] (vm.js:41:22)
778 at parseArgv (/Users/trentm/tm/node-bunyan-0.x/bin/bunyan:477:18)
779 at main (/Users/trentm/tm/node-bunyan-0.x/bin/bunyan:1252:16)
780 at Object.<anonymous> (/Users/trentm/tm/node-bunyan-0.x/bin/bunyan:1330:3)
781 at Module._compile (module.js:449:26)
782 at Object.Module._extensions..js (module.js:467:10)
783 at Module.load (module.js:356:32)
784 at Function.Module._load (module.js:312:12)
785 at Module.runMain (module.js:492:10)
786
787 A proper way to do that condition would be:
788
789 $ bunyan portal.log -c 'this.req && this.req.username=="bob"'
790
791
792
793## 0.16.7
794
795- [issue #59] Clear a possibly interrupted ANSI color code on signal
796 termination.
797
798
799## 0.16.6
800
801- [issue #56] Support `bunyan -p NAME` to dtrace all PIDs matching 'NAME' in
802 their command and args (using `ps -A -o pid,command | grep NAME` or, on SunOS
803 `pgrep -lf NAME`). E.g.:
804
805 bunyan -p myappname
806
807 This is useful for usage of node's [cluster
808 module](http://nodejs.org/docs/latest/api/all.html#all_cluster) where you'll
809 have multiple worker processes.
810
811
812## 0.16.5
813
814- Allow `bunyan -p '*'` to capture bunyan dtrace probes from **all** processes.
815- issue #55: Add support for `BUNYAN_NO_COLOR` environment variable to
816 turn off all output coloring. This is still overridden by the `--color`
817 and `--no-color` options.
818
819
820## 0.16.4
821
822- issue #54: Ensure (again, see 0.16.2) that stderr from the dtrace child
823 process (when using `bunyan -p PID`) gets through. There had been a race
824 between exiting bunyan and the flushing of the dtrace process' stderr.
825
826
827## 0.16.3
828
829- Drop 'trentm-dtrace-provider' fork dep now that
830 <https://github.com/chrisa/node-dtrace-provider/pull/24> has been resolved.
831 Back to dtrace-provider.
832
833
834## 0.16.2
835
836- Ensure that stderr from the dtrace child process (when using `bunyan -p PID`)
837 gets through. The `pipe` usage wasn't working on SmartOS. This is important
838 to show the user if they need to 'sudo'.
839
840
841## 0.16.1
842
843- Ensure that a possible dtrace child process (with using `bunyan -p PID`) is
844 terminated on signal termination of the bunyan CLI (at least for SIGINT,
845 SIGQUIT, SIGTERM, SIGHUP).
846
847
848## 0.16.0
849
850- Add `bunyan -p PID` support. This is a convenience wrapper that effectively
851 calls:
852
853 dtrace -x strsize=4k -qn 'bunyan$PID:::log-*{printf("%s", copyinstr(arg0))}' | bunyan
854
855
856## 0.15.0
857
858- issue #48: Dtrace support! The elevator pitch is you can watch all logging
859 from all Bunyan-using process with something like this:
860
861 dtrace -x strsize=4k -qn 'bunyan*:::log-*{printf("%d: %s: %s", pid, probefunc, copyinstr(arg0))}'
862
863 And this can include log levels *below* what the service is actually configured
864 to log. E.g. if the service is only logging at INFO level and you need to see
865 DEBUG log messages, with this you can. Obviously this only works on dtrace-y
866 platforms: Illumos derivatives of SunOS (e.g. SmartOS, OmniOS), Mac, FreeBSD.
867
868 Or get the bunyan CLI to render logs nicely:
869
870 dtrace -x strsize=4k -qn 'bunyan*:::log-*{printf("%s", copyinstr(arg0))}' | bunyan
871
872 See <https://github.com/trentm/node-bunyan#dtrace-support> for details. By
873 Bryan Cantrill.
874
875
876## 0.14.6
877
878- Export `bunyan.safeCycles()`. This may be useful for custom `type == "raw"`
879 streams that may do JSON stringification of log records themselves. Usage:
880
881 var str = JSON.stringify(rec, bunyan.safeCycles());
882
883- [issue #49] Allow a `log.child()` to specify the level of inherited streams.
884 For example:
885
886 # Before
887 var childLog = log.child({...});
888 childLog.level('debug');
889
890 # After
891 var childLog = log.child({..., level: 'debug'});
892
893- Improve the Bunyan CLI crash message to make it easier to provide relevant
894 details in a bug report.
895
896
897## 0.14.5
898
899- Fix a bug in the long-stack-trace error serialization added in 0.14.4. The
900 symptom:
901
902 bunyan@0.14.4: .../node_modules/bunyan/lib/bunyan.js:1002
903 var ret = ex.stack || ex.toString();
904 ^
905 TypeError: Cannot read property 'stack' of undefined
906 at getFullErrorStack (.../node_modules/bunyan/lib/bunyan.js:1002:15)
907 ...
908
909
910## 0.14.4
911
912- **Bad release. Use 0.14.5 instead.**
913- Improve error serialization to walk the chain of `.cause()` errors
914 from the likes of `WError` or `VError` error classes from
915 [verror](https://github.com/davepacheco/node-verror) and
916 [restify v2.0](https://github.com/mcavage/node-restify). Example:
917
918 [2012-10-11T00:30:21.871Z] ERROR: imgapi/99612 on 0525989e-2086-4270-b960-41dd661ebd7d: my-message
919 ValidationFailedError: my-message; caused by TypeError: cause-error-message
920 at Server.apiPing (/opt/smartdc/imgapi/lib/app.js:45:23)
921 at next (/opt/smartdc/imgapi/node_modules/restify/lib/server.js:550:50)
922 at Server.setupReq (/opt/smartdc/imgapi/lib/app.js:178:9)
923 at next (/opt/smartdc/imgapi/node_modules/restify/lib/server.js:550:50)
924 at Server.parseBody (/opt/smartdc/imgapi/node_modules/restify/lib/plugins/body_parser.js:15:33)
925 at next (/opt/smartdc/imgapi/node_modules/restify/lib/server.js:550:50)
926 at Server.parseQueryString (/opt/smartdc/imgapi/node_modules/restify/lib/plugins/query.js:40:25)
927 at next (/opt/smartdc/imgapi/node_modules/restify/lib/server.js:550:50)
928 at Server._run (/opt/smartdc/imgapi/node_modules/restify/lib/server.js:579:17)
929 at Server._handle.log.trace.req (/opt/smartdc/imgapi/node_modules/restify/lib/server.js:480:38)
930 Caused by: TypeError: cause-error-message
931 at Server.apiPing (/opt/smartdc/imgapi/lib/app.js:40:25)
932 at next (/opt/smartdc/imgapi/node_modules/restify/lib/server.js:550:50)
933 at Server.setupReq (/opt/smartdc/imgapi/lib/app.js:178:9)
934 at next (/opt/smartdc/imgapi/node_modules/restify/lib/server.js:550:50)
935 at Server.parseBody (/opt/smartdc/imgapi/node_modules/restify/lib/plugins/body_parser.js:15:33)
936 at next (/opt/smartdc/imgapi/node_modules/restify/lib/server.js:550:50)
937 at Server.parseQueryString (/opt/smartdc/imgapi/node_modules/restify/lib/plugins/query.js:40:25)
938 at next (/opt/smartdc/imgapi/node_modules/restify/lib/server.js:550:50)
939 at Server._run (/opt/smartdc/imgapi/node_modules/restify/lib/server.js:579:17)
940 at Server._handle.log.trace.req (/opt/smartdc/imgapi/node_modules/restify/lib/server.js:480:38)
941
942
943## 0.14.2
944
945- [issue #45] Fix bunyan CLI (default output mode) to not crash on a 'res'
946 field that isn't a response object, but a string.
947
948
949## 0.14.1
950
951- [issue #44] Fix the default `bunyan` CLI output of a `res.body` that is an
952 object instead of a string. See issue#38 for the same with `req.body`.
953
954
955## 0.14.0
956
957- [pull #41] Safe `JSON.stringify`ing of emitted log records to avoid blowing
958 up on circular objects (by Isaac Schlueter).
959
960
961## 0.13.5
962
963- [issue #39] Fix a bug with `client_req` handling in the default output
964 of the `bunyan` CLI.
965
966
967## 0.13.4
968
969- [issue #38] Fix the default `bunyan` CLI output of a `req.body` that is an
970 object instead of a string.
971
972
973## 0.13.3
974
975- Export `bunyan.resolveLevel(NAME-OR-NUM)` to resolve a level name or number
976 to its log level number value:
977
978 > bunyan.resolveLevel('INFO')
979 30
980 > bunyan.resolveLevel('debug')
981 20
982
983 A side-effect of this change is that the uppercase level name is now allowed
984 in the logger constructor.
985
986
987## 0.13.2
988
989- [issue #35] Ensure that an accidental `log.info(BUFFER)`, where BUFFER is
990 a node.js Buffer object, doesn't blow up.
991
992
993## 0.13.1
994
995- [issue #34] Ensure `req.body`, `res.body` and other request/response fields
996 are emitted by the `bunyan` CLI (mostly by Rob Gulewich).
997
998
999
1000## 0.13.0
1001
1002- [issue #31] Re-instate defines for the (uppercase) log level names (TRACE,
1003 DEBUG, etc.) in `bunyan -c "..."` filtering condition code. E.g.:
1004
1005 $ ... | bunyan -c 'level >= ERROR'
1006
1007
1008## 0.12.0
1009
1010- [pull #32] `bunyan -o short` for more concise output (by Dave Pacheco). E.g.:
1011
1012 22:56:52.856Z INFO myservice: My message
1013
1014 instead of:
1015
1016 [2012-02-08T22:56:52.856Z] INFO: myservice/123 on example.com: My message
1017
1018
1019## 0.11.3
1020
1021- Add '--strict' option to `bunyan` CLI to suppress all but legal Bunyan JSON
1022 log lines. By default non-JSON, and non-Bunyan lines are passed through.
1023
1024
1025## 0.11.2
1026
1027- [issue #30] Robust handling of 'req' field without a 'headers' subfield
1028 in `bunyan` CLI.
1029- [issue #31] Pull the TRACE, DEBUG, et al defines from `bunyan -c "..."`
1030 filtering code. This was added in v0.11.1, but has a significant adverse
1031 affect.
1032
1033
1034## 0.11.1
1035
1036- **Bad release. The TRACE et al names are bleeding into the log records
1037 when using '-c'.**
1038- Add defines for the (uppercase) log level names (TRACE, DEBUG, etc.) in
1039 `bunyan -c "..."` filtering condition code. E.g.:
1040
1041 $ ... | bunyan -c 'level >= ERROR'
1042
1043
1044## 0.11.0
1045
1046- [pull #29] Add -l/--level for level filtering, and -c/--condition for
1047 arbitrary conditional filtering (by github.com/isaacs):
1048
1049 $ ... | bunyan -l error # filter out log records below error
1050 $ ... | bunyan -l 50 # numeric value works too
1051 $ ... | bunyan -c 'level===50' # equiv with -c filtering
1052 $ ... | bunyan -c 'pid===123' # filter on any field
1053 $ ... | bunyan -c 'pid===123' -c '_audit' # multiple filters
1054
1055
1056## 0.10.0
1057
1058- [pull #24] Support for gzip'ed log files in the bunyan CLI (by
1059 github.com/mhart):
1060
1061 $ bunyan foo.log.gz
1062 ...
1063
1064
1065## 0.9.0
1066
1067- [pull #16] Bullet proof the `bunyan.stdSerializers` (by github.com/rlidwka).
1068
1069- [pull #15] The `bunyan` CLI will now chronologically merge multiple log
1070 streams when it is given multiple file arguments. (by github.com/davepacheco)
1071
1072 $ bunyan foo.log bar.log
1073 ... merged log records ...
1074
1075- [pull #15] A new `bunyan.RingBuffer` stream class that is useful for
1076 keeping the last N log messages in memory. This can be a fast way to keep
1077 recent, and thus hopefully relevant, log messages. (by @dapsays,
1078 github.com/davepacheco)
1079
1080 Potential uses: Live debugging if a running process could inspect those
1081 messages. One could dump recent log messages at a finer log level than is
1082 typically logged on
1083 [`uncaughtException`](http://nodejs.org/docs/latest/api/all.html#all_event_uncaughtexception).
1084
1085 var ringbuffer = new bunyan.RingBuffer({ limit: 100 });
1086 var log = new bunyan({
1087 name: 'foo',
1088 streams: [{
1089 type: 'raw',
1090 stream: ringbuffer,
1091 level: 'debug'
1092 }]
1093 });
1094
1095 log.info('hello world');
1096 console.log(ringbuffer.records);
1097
1098- Add support for "raw" streams. This is a logging stream that is given
1099 raw log record objects instead of a JSON-stringified string.
1100
1101 function Collector() {
1102 this.records = [];
1103 }
1104 Collector.prototype.write = function (rec) {
1105 this.records.push(rec);
1106 }
1107 var log = new Logger({
1108 name: 'mylog',
1109 streams: [{
1110 type: 'raw',
1111 stream: new Collector()
1112 }]
1113 });
1114
1115 See "examples/raw-stream.js". I expect raw streams to be useful for
1116 piping Bunyan logging to separate services (e.g. <http://www.loggly.com/>,
1117 <https://github.com/etsy/statsd>) or to separate in-process handling.
1118
1119- Add test/corpus/*.log files (accidentally excluded) so the test suite
1120 actually works(!).
1121
1122
1123## 0.8.0
1124
1125- [pull #21] Bunyan loggers now re-emit `fs.createWriteStream` error events.
1126 By github.com/EvanOxfeld. See "examples/handle-fs-error.js" and
1127 "test/error-event.js" for details.
1128
1129 var log = new Logger({name: 'mylog', streams: [{path: FILENAME}]});
1130 log.on('error', function (err, stream) {
1131 // Handle error writing to or creating FILENAME.
1132 });
1133
1134- jsstyle'ing (via `make check`)
1135
1136
1137## 0.7.0
1138
1139- [issue #12] Add `bunyan.createLogger(OPTIONS)` form, as is more typical in
1140 node.js APIs. This'll eventually become the preferred form.
1141
1142
1143## 0.6.9
1144
1145- Change `bunyan` CLI default output to color "src" info red. Before the "src"
1146 information was uncolored. The "src" info is the filename, line number and
1147 function name resulting from using `src: true` in `Logger` creation. I.e.,
1148 the `(/Users/trentm/tm/node-bunyan/examples/hi.js:10)` in:
1149
1150 [2012-04-10T22:28:58.237Z] INFO: myapp/39339 on banana.local (/Users/trentm/tm/node-bunyan/examples/hi.js:10): hi
1151
1152- Tweak `bunyan` CLI default output to still show an "err" field if it doesn't
1153 have a "stack" attribute.
1154
1155
1156## 0.6.8
1157
1158- Fix bad bug in `log.child({...}, true);` where the added child fields **would
1159 be added to the parent's fields**. This bug only existed for the "fast child"
1160 path (that second `true` argument). A side-effect of fixing this is that
1161 the "fast child" path is only 5 times as fast as the regular `log.child`,
1162 instead of 10 times faster.
1163
1164
1165## 0.6.7
1166
1167- [issue #6] Fix bleeding 'type' var to global namespace. (Thanks Mike!)
1168
1169
1170## 0.6.6
1171
1172- Add support to the `bunyan` CLI taking log file path args, `bunyan foo.log`,
1173 in addition to the usual `cat foo.log | bunyan`.
1174- Improve reliability of the default output formatting of the `bunyan` CLI.
1175 Before it could blow up processing log records missing some expected
1176 fields.
1177
1178
1179## 0.6.5
1180
1181- ANSI coloring output from `bunyan` CLI tool (for the default output mode/style).
1182 Also add the '--color' option to force coloring if the output stream is not
1183 a TTY, e.g. `cat my.log | bunyan --color | less -R`. Use `--no-color` to
1184 disable coloring, e.g. if your terminal doesn't support ANSI codes.
1185- Add 'level' field to log record before custom fields for that record. This
1186 just means that the raw record JSON will show the 'level' field earlier,
1187 which is a bit nicer for raw reading.
1188
1189
1190## 0.6.4
1191
1192- [issue #5] Fix `log.info() -> boolean` to work properly. Previous all were
1193 returning false. Ditto all trace/debug/.../fatal methods.
1194
1195
1196## 0.6.3
1197
1198- Allow an optional `msg` and arguments to the `log.info(<Error> err)` logging
1199 form. For example, before:
1200
1201 log.debug(my_error_instance) // good
1202 log.debug(my_error_instance, "boom!") // wasn't allowed
1203
1204 Now the latter is allowed if you want to expliciting set the log msg. Of course
1205 this applies to all the `log.{trace|debug|info...}()` methods.
1206
1207- `bunyan` cli output: clarify extra fields with quoting if empty or have
1208 spaces. E.g. 'cmd' and 'stderr' in the following:
1209
1210 [2012-02-12T00:30:43.736Z] INFO: mo-docs/43194 on banana.local: buildDocs results (req_id=185edca2-2886-43dc-911c-fe41c09ec0f5, route=PutDocset, error=null, stderr="", cmd="make docs")
1211
1212
1213## 0.6.2
1214
1215- Fix/guard against unintended inclusion of some files in npm published package
1216 due to <https://github.com/isaacs/npm/issues/2144>
1217
1218
1219## 0.6.1
1220
1221- Internal: starting jsstyle usage.
1222- Internal: add .npmignore. Previous packages had reams of bunyan crud in them.
1223
1224
1225## 0.6.0
1226
1227- Add 'pid' automatic log record field.
1228
1229
1230## 0.5.3
1231
1232- Add 'client_req' (HTTP client request) standard formatting in `bunyan` CLI
1233 default output.
1234- Improve `bunyan` CLI default output to include *all* log record keys. Unknown keys
1235 are either included in the first line parenthetical (if short) or in the indented
1236 subsequent block (if long or multiline).
1237
1238
1239## 0.5.2
1240
1241- [issue #3] More type checking of `new Logger(...)` and `log.child(...)`
1242 options.
1243- Start a test suite.
1244
1245
1246## 0.5.1
1247
1248- [issue #2] Add guard on `JSON.stringify`ing of log records before emission.
1249 This will prevent `log.info` et al throwing on record fields that cannot be
1250 represented as JSON. An error will be printed on stderr and a clipped log
1251 record emitted with a 'bunyanMsg' key including error details. E.g.:
1252
1253 bunyan: ERROR: could not stringify log record from /Users/trentm/tm/node-bunyan/examples/unstringifyable.js:12: TypeError: Converting circular structure to JSON
1254 {
1255 "name": "foo",
1256 "hostname": "banana.local",
1257 "bunyanMsg": "bunyan: ERROR: could not stringify log record from /Users/trentm/tm/node-bunyan/examples/unstringifyable.js:12: TypeError: Converting circular structure to JSON",
1258 ...
1259
1260 Some timing shows this does effect log speed:
1261
1262 $ node tools/timeguard.js # before
1263 Time try/catch-guard on JSON.stringify:
1264 - log.info: 0.07365ms per iteration
1265 $ node tools/timeguard.js # after
1266 Time try/catch-guard on JSON.stringify:
1267 - log.info: 0.07368ms per iteration
1268
1269
1270## 0.5.0
1271
1272- Use 10/20/... instead of 1/2/... for level constant values. Ostensibly this
1273 allows for intermediary levels from the defined "trace/debug/..." set.
1274 However, that is discouraged. I'd need a strong user argument to add
1275 support for easily using alternative levels. Consider using a separate
1276 JSON field instead.
1277- s/service/name/ for Logger name field. "service" is unnecessarily tied
1278 to usage for a service. No need to differ from log4j Logger "name".
1279- Add `log.level(...)` and `log.levels(...)` API for changing logger stream
1280 levels.
1281- Add `TRACE|DEBUG|INFO|WARN|ERROR|FATAL` level constants to exports.
1282- Add `log.info(err)` special case for logging an `Error` instance. For
1283 example `log.info(new TypeError("boom")` will produce:
1284
1285 ...
1286 "err": {
1287 "message": "boom",
1288 "name": "TypeError",
1289 "stack": "TypeError: boom\n at Object.<anonymous> ..."
1290 },
1291 "msg": "boom",
1292 ...
1293
1294
1295## 0.4.0
1296
1297- Add `new Logger({src: true})` config option to have a 'src' attribute be
1298 automatically added to log records with the log call source info. Example:
1299
1300 "src": {
1301 "file": "/Users/trentm/tm/node-bunyan/examples/src.js",
1302 "line": 20,
1303 "func": "Wuzzle.woos"
1304 },
1305
1306
1307## 0.3.0
1308
1309- `log.child(options[, simple])` Added `simple` boolean arg. Set `true` to
1310 assert that options only add fields (no config changes). Results in a 10x
1311 speed increase in child creation. See "tools/timechild.js". On my Mac,
1312 "fast child" creation takes about 0.001ms. IOW, if your app is dishing
1313 10,000 req/s, then creating a log child for each request will take
1314 about 1% of the request time.
1315- `log.clone` -> `log.child` to better reflect the relationship: streams and
1316 serializers are inherited. Streams can't be removed as part of the child
1317 creation. The child doesn't own the parent's streams (so can't close them).
1318- Clean up Logger creation. The goal here was to ensure `log.child` usage
1319 is fast. TODO: measure that.
1320- Add `Logger.stdSerializers.err` serializer which is necessary to get good
1321 Error object logging with node 0.6 (where core Error object properties
1322 are non-enumerable).
1323
1324
1325## 0.2.0
1326
1327- Spec'ing core/recommended log record fields.
1328- Add `LOG_VERSION` to exports.
1329- Improvements to request/response serializations.
1330
1331
1332## 0.1.0
1333
1334First release.