Comparing version 0.16.7 to 0.16.8
@@ -9,2 +9,73 @@ # bunyan Changelog | ||
## bunyan 0.16.8 | ||
- Guards on `-c CONDITION` usage to attempt to be more user friendly. | ||
Bogus JS code will result in this: | ||
$ bunyan portal.log -c 'this.req.username==boo@foo' | ||
bunyan: error: illegal CONDITION code: SyntaxError: Unexpected token ILLEGAL | ||
CONDITION script: | ||
Object.prototype.TRACE = 10; | ||
Object.prototype.DEBUG = 20; | ||
Object.prototype.INFO = 30; | ||
Object.prototype.WARN = 40; | ||
Object.prototype.ERROR = 50; | ||
Object.prototype.FATAL = 60; | ||
this.req.username==boo@foo | ||
Error: | ||
SyntaxError: Unexpected token ILLEGAL | ||
at new Script (vm.js:32:12) | ||
at Function.Script.createScript (vm.js:48:10) | ||
at parseArgv (/Users/trentm/tm/node-bunyan-0.x/bin/bunyan:465:27) | ||
at main (/Users/trentm/tm/node-bunyan-0.x/bin/bunyan:1252:16) | ||
at Object.<anonymous> (/Users/trentm/tm/node-bunyan-0.x/bin/bunyan:1330:3) | ||
at Module._compile (module.js:449:26) | ||
at Object.Module._extensions..js (module.js:467:10) | ||
at Module.load (module.js:356:32) | ||
at Function.Module._load (module.js:312:12) | ||
at Module.runMain (module.js:492:10) | ||
And all CONDITION scripts will be run against a minimal valid Bunyan | ||
log record to ensure they properly guard against undefined values | ||
(at least as much as can reasonably be checked). For example: | ||
$ bunyan portal.log -c 'this.req.username=="bob"' | ||
bunyan: error: CONDITION code cannot safely filter a minimal Bunyan log record | ||
CONDITION script: | ||
Object.prototype.TRACE = 10; | ||
Object.prototype.DEBUG = 20; | ||
Object.prototype.INFO = 30; | ||
Object.prototype.WARN = 40; | ||
Object.prototype.ERROR = 50; | ||
Object.prototype.FATAL = 60; | ||
this.req.username=="bob" | ||
Minimal Bunyan log record: | ||
{ | ||
"v": 0, | ||
"level": 30, | ||
"name": "name", | ||
"hostname": "hostname", | ||
"pid": 123, | ||
"time": 1355514346206, | ||
"msg": "msg" | ||
} | ||
Filter error: | ||
TypeError: Cannot read property 'username' of undefined | ||
at bunyan-condition-0:7:9 | ||
at Script.Object.keys.forEach.(anonymous function) [as runInNewContext] (vm.js:41:22) | ||
at parseArgv (/Users/trentm/tm/node-bunyan-0.x/bin/bunyan:477:18) | ||
at main (/Users/trentm/tm/node-bunyan-0.x/bin/bunyan:1252:16) | ||
at Object.<anonymous> (/Users/trentm/tm/node-bunyan-0.x/bin/bunyan:1330:3) | ||
at Module._compile (module.js:449:26) | ||
at Object.Module._extensions..js (module.js:467:10) | ||
at Module.load (module.js:356:32) | ||
at Function.Module._load (module.js:312:12) | ||
at Module.runMain (module.js:492:10) | ||
A proper way to do that condition would be: | ||
$ bunyan portal.log -c 'this.req && this.req.username=="bob"' | ||
## bunyan 0.16.7 | ||
@@ -11,0 +82,0 @@ |
@@ -7,3 +7,3 @@ /* | ||
var VERSION = '0.16.7'; | ||
var VERSION = '0.16.8'; | ||
@@ -10,0 +10,0 @@ // Bunyan log format version. This becomes the 'v' field on all log records. |
{ | ||
"name": "bunyan", | ||
"version": "0.16.7", | ||
"version": "0.16.8", | ||
"description": "a JSON Logger library for node.js services", | ||
@@ -5,0 +5,0 @@ "author": "Trent Mick <trentm@gmail.com> (http://trentm.com)", |
@@ -76,6 +76,6 @@ Bunyan is **a simple and fast a JSON logging library** for node.js services and | ||
A `bunyan` tool is provided **for pretty-printing bunyan logs** and, eventually, | ||
for filtering (e.g. `| bunyan -c 'level>3'`). This shows the default output | ||
(which is fluid right now) and indented-JSON output. More output formats will | ||
be added, including support for custom formats. | ||
A `bunyan` tool is provided **for pretty-printing bunyan logs** and for | ||
**filtering** (e.g. `| bunyan -c 'this.foo == "bar"'`). This shows the default | ||
output and indented-JSON output. More output formats will be added, including | ||
support for custom formats. | ||
@@ -82,0 +82,0 @@ $ node hi.js | ./bin/bunyan # CLI tool to filter/pretty-print JSON logs. |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
284531