Commit graph

94 commits

Author SHA1 Message Date
Cody Peter Mello
3cde7bcb3b mkLogEmitter closures unnecessary for disabled log levels and have perf impact 2016-11-14 18:26:52 +00:00
Trent Mick
2390bf8df2 v1.8.3. Fix log.info(null) crash that resulted from in v1.8.2.
Fixes 
2016-10-18 13:13:20 -07:00
Trent Mick
778d0f7049 Fix bunyan -p ... (i.e. DTrace integration) on node 4.x and 5.x
This never worked with node >0.x because of faulty logic determining
`nodeSpawnSupportsStdio` -- attempting to compare with, e.g.,
`Number('v1')`.

Fixes 
2016-03-16 22:32:52 -07:00
Michael Nisi
cf1926fef6 Ensure stream for type='stream' stream is a writable stream :)
Fixes 
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 (), Jeremy Ruppel (),
and Aleksey Timchenko ().
2016-02-21 13:31:57 -08:00
Trent Mick
8b94e81fa7 'reemitErrorEvents' bool on Bunyan streams to control error event handling
Related to PR .
2016-02-20 18:04:47 -08:00
Trent Mick
6fdc5ff209 Style/changelog/readme/test case for "error" event re-emitting.
PR: 
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 

 [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 . Fixes .
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 .
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 .
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 .
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