Skip to content

Commit 4d6b159

Browse files
committedSep 27, 2016
a fix for circular references in the record
1 parent cd290ba commit 4d6b159

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed
 

‎lib/bunyan-stackdriver.js

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
var util = require('util');
22
var logging = require('@google-cloud/logging');
33
var Writable = require('stream').Writable;
4+
var destroyCircular = require('destroy-circular');
45

56
const nameFromLevel = {
67
10: 'trace',
@@ -88,6 +89,8 @@ BunyanStackDriver.prototype._write = function write(record, encoding, callback)
8889
timestamp = record.time;
8990
}
9091

92+
//This might slow down the logging a bit, but will protect against circular references
93+
record = destroyCircular(record);
9194
strictJSON(record);
9295

9396
var entry = this.log.entry(this.resource, record);

‎package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
},
2222
"homepage": "https://github.com/mlazarov/bunyan-stackdriver",
2323
"dependencies": {
24-
"@google-cloud/logging": "^0.1.1"
24+
"@google-cloud/logging": "^0.1.1",
25+
"destroy-circular": "^1.1.0"
2526
},
2627
"devDependencies": {
2728
"bunyan": "^1.3.3"

0 commit comments

Comments
 (0)
Failed to load comments.