Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bunyan

Package Overview
Dependencies
Maintainers
1
Versions
112
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bunyan - npm Package Compare versions

Comparing version 0.13.5 to 0.14.0

bar.js

6

CHANGES.md
# bunyan Changelog
## bunyan 0.14.0
- [pull #41] Safe `JSON.stringify`ing of emitted log records to avoid blowing
up on circular objects (by Isaac Schlueter).
## bunyan 0.13.5

@@ -4,0 +10,0 @@

38

lib/bunyan.js

@@ -7,3 +7,3 @@ /*

var VERSION = '0.13.5';
var VERSION = '0.14.0';

@@ -73,3 +73,3 @@ // Bunyan log format version. This becomes the 'v' field on all log records.

case '%d': return Number(args[i++]);
case '%j': return JSON.stringify(args[i++]);
case '%j': return JSON.stringify(args[i++], safeCycles());
case '%%': return '%';

@@ -677,20 +677,3 @@ default:

if (this.haveNonRawStreams) {
try {
str = JSON.stringify(obj) + '\n';
} catch (e) {
var src = ((obj.src && obj.src.file) ? obj.src : getCaller3Info());
var emsg = format('bunyan: ERROR: could not stringify log record from '
+ '%s:%d: %s', src.file, src.line, e);
var eobj = objCopy(rec[0]);
eobj.bunyanMsg = emsg;
eobj.msg = obj.msg;
eobj.time = obj.time;
eobj.v = LOG_VERSION;
_warn(emsg, src.file, src.line);
try {
str = JSON.stringify(eobj) + '\n';
} catch (e2) {
str = JSON.stringify({bunyanMsg: emsg});
}
}
str = JSON.stringify(obj, safeCycles()) + '\n';
}

@@ -1028,2 +1011,17 @@

// A JSON stringifier that handles cycles safely.
// Usage: JSON.stringify(obj, safeCycles())
function safeCycles() {
var seen = [];
return function(key, val) {
if (!val || typeof val !== 'object') {
return val;
}
if (seen.indexOf(val) !== -1) {
return '[Circular]';
}
seen.push(val);
return val;
};
}

@@ -1030,0 +1028,0 @@ /**

{
"name": "bunyan",
"version": "0.13.5",
"version": "0.14.0",
"description": "a JSON Logger library for node.js services",

@@ -5,0 +5,0 @@ "author": "Trent Mick <trentm@gmail.com> (http://trentm.com)",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc