Commit graph

76 commits

Author SHA1 Message Date
Trent Mick
5d666f49f1 update tests to run against some io.js versions. Minor test case fix for io.js slight diff to 0.12. 2015-06-07 11:06:50 -07:00
Trent Mick
e71890562e fix some test failures 2015-06-04 00:35:18 -07:00
Trent Mick
762e26713c Make bunyan defensive on res.header=null.
Fixes .
Also add test case for this and a couple recent `bunyan` crashers.
2015-04-15 09:21:31 -07:00
Trent Mick
64b8fd1004 test cases for , style tweaks, changelog, etc. 2015-01-18 23:27:28 -08:00
Martin Gausby
c0ca774238 Defend against throwing defined props in stringify
If an object has a defined property, that is enumerable, and this
property throws an error, it will make JSON stringify throw an
error, and potentially bring down the program.

The solution so far is to try-catch with the usual json stringifyer,
that guards against circular references. If this throws an error
we will attempt to guard against defined properties; and return
[Throws] if a property throws an error when accesed.

The following examples illustrate the problem:

```js
var obj = {};
obj.__defineGetter__('foo', function() { throw new Error('ouch!'); });

JSON.stringify(obj.foo); // error thrown
```

And using `Object.defineProperty`:
```js
var obj = {};
Object.defineProperty(obj, 'foo', {
    get: function() { throw new Error('ouch!'); }
    enumerable: true // enumerable is false by default
});

JSON.stringify(obj.foo); // error thrown
```

The cases we have seen in production is third party modules that
has enumerable getters that try to access properties on undefined
objects.

Fixes .
2015-01-18 23:27:06 -08:00
Trent Mick
08a4bab1ba fix 'make check' 2015-01-17 22:04:39 -08:00
Trent Mick
1ed684d110 Ensure a top-level level given in bunyan.createLogger is *used* for given streams
Fixes 
2015-01-17 20:39:06 -08:00
Trent Mick
74a2a1c57d allow Logger level values outside TRACE..FATAL 2014-11-13 23:15:21 -08:00
Trent Mick
a5ca41a150 Fix a breakage in log.info(err) on a logger with no serializers. 2014-09-27 21:22:17 -07:00
Trent Mick
db85a851fe Fix 'make check' 2014-09-27 21:04:34 -07:00
Mihai Tomescu
92a4e2b81b removed empty lines 2014-09-13 20:16:46 -04:00
Mihai Tomescu
576e500b11 use the correct error serializer 2014-09-13 20:12:09 -04:00
Trent Mick
7ef6b120db 'make check' clean 2014-08-25 00:50:53 -07:00
Trent Mick
a051565ced Merge pull request from strongloop-forks/constructor-fix
Fix bad constructor guard
2014-08-25 00:10:41 -07:00
Trent Mick
ecf4b8c6a4 Tweak to SIGINT patch from @jnordberg for 2014-08-24 23:34:38 -07:00
Ryan Graham
6b44120d53 test: make throw tests validate was is thrown
When the second argument to nodeunit's assert.throws() is a string it
is used as the failure message, not for exception message matching.

To assert the contents of the exception's message a RegExp must be
used.
2014-08-08 18:28:40 -07:00
Ryan Graham
e4ea3fb05f test: ensure parent type guard is working 2014-08-08 18:28:25 -07:00
Ryan Graham
e8aec58222 test: add test for instanceof ctor guard 2014-08-08 18:25:53 -07:00
Trent Mick
660b706479 doc new -c CODE; drop dtrace-provider as optionalDependency (fixes ); add 'bunyan -0' shortcut 2014-08-01 15:57:48 -07:00
Patrick Mooney
042e2c0fc9 [issue ] Kill vm.runInNewContext with fire
Change default condition evaluation from vm.runInNewContext to
eval-style functions.  Use of "naked" variables (pid === 123, etc) no
longer works, making this.<name> variable qualification necessary.
2014-07-31 20:48:31 -05:00
Trent Mick
687b16b42c make check 2014-05-31 23:00:13 -07:00
Trent Mick
4670906256 skip rotating-file test on node 0.8; warn about rotating-file issues 2014-05-31 22:57:36 -07:00
Trent Mick
42e99323ee 'make check' 2014-05-31 22:25:06 -07:00
Trent Mick
7fb58aa5e4 Merge pull request from ascom-au/master
Rotating-file stream prevent process from exiting
2014-05-31 22:17:09 -07:00
Trent Mick
d305801472 [issue ] Fix bunyan crash on a log record with res.header that is an object. 2014-05-29 00:13:01 -07:00
Trent Mick
fc0150f9fb [issue ] Ensure logging a non-object/non-string doesn't throw 2014-05-28 23:24:57 -07:00
Glenn Murray
6f2cc6be2d Graceful termination failing test for and
Will fail if any timers or callbacks remain registered when
instantiating a logger with a rotating file.
2014-03-04 15:45:54 +11:00
Trent Mick
a111200a5a make check 2013-04-01 17:21:01 -07:00
Trent Mick
f616276dc6 style: 4-space indents 2013-03-28 17:42:32 -07:00
Trent Mick
7a6c3f5ce6 more 'make check' jsstyle fixes 2013-03-28 17:39:00 -07:00
Trent Mick
1a8be0c1e6 OS-2030, smartos-live : fix serializer bug added in bunyan 0.18.3 2013-03-15 11:25:56 -07:00
Trent Mick
cbfb9b010b fix the test suite for 0.10.0 2013-03-11 10:48:16 -07:00
Trent Mick
947705ad1e 'long' and 'bunyan' output formats 2013-03-08 16:32:10 -08:00
Trent Mick
f096b303c1 exclude domain keys on error objects for 'err' serializer 2013-03-01 16:58:56 -08:00
Trent Mick
b1c143c87a bunyan CLI auto-paging 2013-01-18 21:24:23 -08:00
Trent Mick
bd4dec5bec move test suite to nodeunit 2013-01-07 11:18:12 -08:00
Trent Mick
4145e63a6f fix test case for latency tweak in CLI output 2012-12-27 17:09:30 -08:00
Trent Mick
da55eeee60 back to dtrace-provider dep 2012-11-02 13:36:46 -07:00
Trent Mick
b260bdb934 more reliable dtrace test, drop node0.9 testing (dtrace-provider doesn't work) 2012-11-01 20:05:56 +00:00
Trent Mick
bac8a57663 semi-reliable test case for dtrace support 2012-11-01 19:12:39 +00:00
Trent Mick
8732764c67 issue : changelog, add Bryan to AUTHORS, basic dtrace test suite
The test suite for this is a bit finnicky because root rights are
required to run dtrace. By default we run the dtrace.test.js file
with 'sudo'. Use this to skip the dtrace tests:
    SKIP_DTRACE=1 make test

Note taht 'make test09' is busted because dtrace-provider seems
busted with node 0.9.1 at least.
2012-10-31 23:52:53 -07:00
Trent Mick
677a485348 [issue ] Allow a log.child() to specify the level of inherited streams. 2012-10-22 22:30:00 -07:00
Trent Mick
e203c9fa56 fix long-stack-trace error serialization added in 0.14.4 2012-10-11 14:02:48 -07:00
Trent Mick
8a7d743152 [issue ] Fix bunyan CLI (default output mode) to not crash on a 'res' field that isn't a response object, but a string. 2012-10-10 11:39:29 -07:00
isaacs
c2338b117c JSON.stringify safely 2012-09-10 11:24:39 -07:00
Trent Mick
db836e2ddd Export bunyan.resolveLevel(NAME-OR-NUM) to resolve a level name or number to its log level number value 2012-08-24 16:28:31 -07:00
Trent Mick
121b360b08 [issue ] Ensure that an accidental log.info(BUFFER), where BUFFER is a node.js Buffer object, doesn't blow up. 2012-08-22 15:04:30 -07:00
Trent Mick
1a9e712dbc [issue ] body et al in request/response output by bunyan CLI
Ensure `req.body`, `res.body` and other request/response
fields are emitted by the `bunyan` CLI (mostly by Rob Gulewich).
2012-08-21 11:04:33 -07:00
Trent Mick
f0a119a306 [issue ] Robust handling of 'req' field without a 'headers' subfield in bunyan CLI. 2012-08-08 22:27:49 -07:00
Trent Mick
b0cd1f628d Fix some accidental t.ends() and corpus paths in test cases for 0.11.0. 2012-08-08 22:12:24 -07:00