Bunyan

Latest version: v0.1.2

Safety actively analyzes 630052 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 9 of 18

0.19.0

**WARNING**: This release includes a bug introduced in bunyan 0.18.3 (see
below). Please upgrade to bunyan 0.20.0.

- [Slight backward incompatibility] Change the default error serialization
(a.k.a. `bunyan.stdSerializers.err`) to *not* serialize all additional
attributes of the given error object. This is an open door to unsafe logging
and logging should always be safe. With this change, error serialization
will log these attributes: message, name, stack, code, signal. The latter
two are added because some core node APIs include those fields (e.g.
`child_process.exec`).

Concrete examples where this has hurt have been the "domain" change
necessitating 0.18.3 and a case where
[node-restify](https://github.com/mcavage/node-restify) uses an error object
as the response object. When logging the `err` and `res` in the same log
statement (common for restify audit logging), the `res.body` would be JSON
stringified as '[Circular]' as it had already been emitted for the `err` key.
This results in a WTF with the bunyan CLI because the `err.body` is not
rendered.

If you need the old behaviour back you will need to do this:

var bunyan = require('bunyan');
var errSkips = {
// Skip domain keys. `domain` especially can have huge objects that can
// OOM your app when trying to JSON.stringify.
domain: true,
domain_emitter: true,
domain_bound: true,
domain_thrown: true
};
bunyan.stdSerializers.err = function err(err) {
if (!err || !err.stack)
return err;
var obj = {
message: err.message,
name: err.name,
stack: getFullErrorStack(err)
}
Object.keys(err).forEach(function (k) {
if (err[k] !== undefined && !errSkips[k]) {
obj[k] = err[k];
}
});
return obj;
};

- "long" and "bunyan" output formats for the CLI. `bunyan -o long` is the default
format, the same as before, just called "long" now instead of the cheesy "paul"
name. The "bunyan" output format is the same as "json-0", just with a more
convenient name.

0.18.3

**WARNING**: This release introduced a bug such that all serializers are
applied to all log records even if the log record did not contain the key
for that serializer. If a logger serializer function does not handle
being given `undefined`, then you'll get warnings like this on stderr:

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: ...
at Object.bunyan.createLogger.serializers.foo (.../myapp.js:20:15)
at Logger._applySerializers (.../lib/bunyan.js:644:46)
at Array.forEach (native)
at Logger._applySerializers (.../lib/bunyan.js:640:33)
...

and the following junk in written log records:

"foo":"(Error in Bunyan log "foo" serializer broke field. See stderr for details.)"

Please upgrade to bunyan 0.20.0.


- Change the `bunyan.stdSerializers.err` serializer for errors to *exclude*
[the "domain*" keys](http://nodejs.org/docs/latest/api/all.htmlall_additions_to_error_objects).
`err.domain` will include its assigned members which can arbitrarily large
objects that are not intended for logging.

- Make the "dtrace-provider" dependency optional. I hate to do this, but
installing bunyan on Windows is made very difficult with this as a required
dep. Even though "dtrace-provider" stubs out for non-dtrace-y platforms,
without a compiler and Python around, node-gyp just falls over.

0.18.2

- [pull 67] Remove debugging prints in rotating-file support.
(by github.com/chad3814).
- Update to dtrace-provider0.2.7.

0.18.1

- Get the `bunyan` CLI to **not** automatically page (i.e. pipe to `less`)
if stdin isn't a TTY, or if following dtrace probe output (via `-p PID`),
or if not given log file arguments.

0.18.0

- Automatic paging support in the `bunyan` CLI (similar to `git log` et al).
IOW, `bunyan` will open your pager (by default `less`) and pipe rendered
log output through it. A main benefit of this is getting colored logs with
a pager without the pain. Before you had to explicit use `--color` to tell
bunyan to color output when the output was not a TTY:

bunyan foo.log --color | less -R before
bunyan foo.log now

Disable with the `--no-pager` option or the `BUNYAN_NO_PAGER=1` environment
variable.

Limitations: Only supported for node >=0.8. Windows is not supported (at
least not yet).

- Switch test suite to nodeunit (still using a node-tap'ish API via
a helper).

0.17.0

- [issue 33] Log rotation support:

var bunyan = require('bunyan');
var log = bunyan.createLogger({
name: 'myapp',
streams: [{
type: 'rotating-file',
path: '/var/log/myapp.log',
count: 7,
period: 'daily'
}]
});


- Tweak to CLI default pretty output: don't special case "latency" field.
The special casing was perhaps nice, but less self-explanatory.
Before:

[2012-12-27T21:17:38.218Z] INFO: audit/45769 on myserver: handled: 200 (15ms, audit=true, bar=baz)
GET /foo
...

After:

[2012-12-27T21:17:38.218Z] INFO: audit/45769 on myserver: handled: 200 (audit=true, bar=baz, latency=15)
GET /foo
...

- *Exit* CLI on EPIPE, otherwise we sit there useless processing a huge log
file with, e.g. `bunyan huge.log | head`.

Page 9 of 18

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.