Commit graph

91 commits

Author SHA1 Message Date
Michael Nisi
cf1926fef6 Ensure stream for type='stream' stream is a writable stream :)
Fixes #332
2016-02-28 22:35:56 -08:00
Michael Nisi
99f3c47793 Check body length to prevent empty lines 2016-02-21 22:20:21 -08:00
Trent Mick
cd7dc6a92c Improve the runtime environment detection to fix running under NW.js.
Contributions by Adam Lynch (#310), Jeremy Ruppel (#311),
and Aleksey Timchenko (#302).
2016-02-21 13:31:57 -08:00
Trent Mick
8b94e81fa7 'reemitErrorEvents' bool on Bunyan streams to control error event handling
Related to PR #318.
2016-02-20 18:04:47 -08:00
Trent Mick
6fdc5ff209 Style/changelog/readme/test case for "error" event re-emitting.
PR: #318
2016-02-10 23:38:23 -08:00
Trent Mick
a826919b99 fix 'make check' 2016-02-10 22:35:33 -08:00
Trent Mick
8bb8a746dc only want TZ set for the tests that need it, not everything run via this Makefile 2016-02-10 22:31:53 -08:00
Trent Mick
6ff1f36abc momentjs: avoid for default fast path; make required only for local time
Make the default (long output format, UTC time) for the bunyan CLI a
fast path that doesn't use moment.js. Admittedly I haven't measured
percentage impact of `moment(rec.time).utc().format(...)` for
many bunyan records.

Also make moment dep *optional*. The bunyan CLI will error out without
the moment dep *only if local time is requested.*
2016-02-10 22:13:01 -08:00
David M. Lee
8df86bccf0 Improved time formatting and conversion
Bunyan CLI was not handling timezone conversion properly when set to use
local time. This patch uses [Moment.js][] to fix those issues.

 * Timezone conversions work properly across DST conversions
 * The timezone, when shown, is correctly shown as `±hh:mm`
 * The timzeone is omitted on short output, since it isn't that short.
   Except when UTC is used, since that can be indicated by the single
   character `Z`

Fixes #245

 [Moment.js]: http://momentjs.com/
2016-02-10 22:03:35 -08:00
Trent Mick
c1662212f8 node-bunyan#252 forgot to commit this file for test case 2016-02-10 00:05:02 -08:00
Trent Mick
30fa3da5e9 node-bunyan#252 changelog and test case 2016-02-10 00:03:21 -08:00
Trent Mick
788ad7cefe fix LOG.child(...) to *not* override the "hostname" field of the parent
Fixes #291. Fixes #303.
2016-02-02 23:45:31 -08:00
Trent Mick
2a5e1fc715 Allow one to set level: 0 in createLogger to turn on logging for all levels.
Fixes #325.
2016-02-02 23:12:02 -08:00
Trent Mick
3671c2c17c fix 'make test4' and 'make test5'. Add testing of node 5 to 'make testall' (working) 2016-01-29 06:47:30 +00:00
Trent Mick
86b6769087 Fix src: true, which was broken in v1.5.0.
Also add a test case for `src: true` which is how 1.5.0 got released
without noticing this.

Fixes #296.
2015-09-07 14:37:29 -07:00
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 #244.
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 #182, 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 #182.
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 #164
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 #159 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 #161 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 #135); add 'bunyan -0' shortcut 2014-08-01 15:57:48 -07:00
Patrick Mooney
042e2c0fc9 [issue #87] 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 #125 from ascom-au/master
Rotating-file stream prevent process from exiting
2014-05-31 22:17:09 -07:00
Trent Mick
d305801472 [issue #139] 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 #85] 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 #97 and #73
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 #184: 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