2015-01-19 07:16:35 +00:00
|
|
|
process.env.BUNYAN_TEST_NO_SAFE_JSON_STRINGIFY = '1';
|
|
|
|
var bunyan = require('../lib/bunyan');
|
|
|
|
|
|
|
|
var log = bunyan.createLogger({
|
|
|
|
name: 'safe-json-stringify-4'
|
|
|
|
});
|
|
|
|
|
|
|
|
// And using `Object.defineProperty`.
|
|
|
|
var obj = {};
|
|
|
|
Object.defineProperty(obj, 'boom', {
|
2015-01-19 07:27:28 +00:00
|
|
|
get: function () { throw new Error('defineProperty ouch!'); },
|
2015-01-19 07:16:35 +00:00
|
|
|
enumerable: true // enumerable is false by default
|
|
|
|
});
|
|
|
|
// Twice to test the 'warnKey' usage.
|
|
|
|
for (var i = 0; i < 2; i++) {
|
|
|
|
log.info({obj: obj}, 'using defineProperty');
|
|
|
|
}
|