@google-cloud/logging
Advanced tools
Comparing version 5.5.0 to 5.5.1
@@ -18,4 +18,5 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const arrify = require("arrify"); | ||
const promisify_1 = require("@google-cloud/promisify"); | ||
const arrify = require("arrify"); | ||
const dotProp = require("dot-prop"); | ||
const extend = require("extend"); | ||
@@ -238,3 +239,3 @@ const entry_1 = require("./entry"); | ||
return; | ||
const delta = payloadSize - this.maxEntrySize; | ||
let delta = payloadSize - this.maxEntrySize; | ||
if (entry.textPayload) { | ||
@@ -244,10 +245,18 @@ entry.textPayload = entry.textPayload.slice(0, Math.max(entry.textPayload.length - delta, 0)); | ||
else { | ||
// Stackdriver Log Viewer picks up the summary line from the | ||
// 'message' field. | ||
if (entry.jsonPayload && | ||
entry.jsonPayload.fields && | ||
entry.jsonPayload.fields.message && | ||
entry.jsonPayload.fields.message.stringValue) { | ||
const text = entry.jsonPayload.fields.message.stringValue; | ||
entry.jsonPayload.fields.message.stringValue = text.slice(0, Math.max(text.length - delta, 0)); | ||
const fieldsToTruncate = [ | ||
// Winston: | ||
'jsonPayload.fields.metadata.structValue.fields.stack.stringValue', | ||
// Bunyan: | ||
'jsonPayload.fields.msg.stringValue', | ||
'jsonPayload.fields.err.structValue.fields.stack.stringValue', | ||
'jsonPayload.fields.err.structValue.fields.message.stringValue', | ||
// All: | ||
'jsonPayload.fields.message.stringValue', | ||
]; | ||
for (const field of fieldsToTruncate) { | ||
const msg = dotProp.get(entry, field, ''); | ||
if (msg !== '') { | ||
dotProp.set(entry, field, msg.slice(0, Math.max(msg.length - delta, 0))); | ||
delta -= Math.min(msg.length, delta); | ||
} | ||
} | ||
@@ -254,0 +263,0 @@ } |
@@ -7,2 +7,9 @@ # Changelog | ||
### [5.5.1](https://www.github.com/googleapis/nodejs-logging/compare/v5.5.0...v5.5.1) (2019-10-17) | ||
### Bug Fixes | ||
* truncate additional fields set by winston/bunyan ([#609](https://www.github.com/googleapis/nodejs-logging/issues/609)) ([27ac693](https://www.github.com/googleapis/nodejs-logging/commit/27ac693ec4f9afeec412e2edddf831226f2bcc60)) | ||
## [5.5.0](https://www.github.com/googleapis/nodejs-logging/compare/v5.4.1...v5.5.0) (2019-10-16) | ||
@@ -9,0 +16,0 @@ |
{ | ||
"name": "@google-cloud/logging", | ||
"description": "Stackdriver Logging Client Library for Node.js", | ||
"version": "5.5.0", | ||
"version": "5.5.1", | ||
"license": "Apache-2.0", | ||
@@ -61,2 +61,3 @@ "author": "Google Inc.", | ||
"arrify": "^2.0.0", | ||
"dot-prop": "^5.1.0", | ||
"eventid": "^0.1.2", | ||
@@ -63,0 +64,0 @@ "extend": "^3.0.2", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3313600
60970
21
+ Addeddot-prop@^5.1.0
+ Addeddot-prop@5.3.0(transitive)
+ Addedis-obj@2.0.0(transitive)