@google-cloud/logging
Advanced tools
Comparing version 9.8.3 to 9.9.0
@@ -17,2 +17,5 @@ /*! | ||
/// <reference types="node" /> | ||
/** | ||
* This is a helper library for synchronously writing logs to any transport. | ||
*/ | ||
import { Logging } from '.'; | ||
@@ -19,0 +22,0 @@ import { Entry, LogEntry } from './entry'; |
@@ -19,7 +19,4 @@ "use strict"; | ||
exports.LogSync = void 0; | ||
/** | ||
* This is a helper library for synchronously writing logs to any transport. | ||
*/ | ||
const arrify = require("arrify"); | ||
const entry_1 = require("./entry"); | ||
const instrumentation_1 = require("./utils/instrumentation"); | ||
const log_common_1 = require("./utils/log-common"); | ||
@@ -331,3 +328,4 @@ /** | ||
try { | ||
structuredEntries = arrify(entry).map(entry => { | ||
// Make sure to add instrumentation info | ||
structuredEntries = instrumentation_1.populateInstrumentationInfo(entry).map(entry => { | ||
if (!(entry instanceof entry_1.Entry)) { | ||
@@ -334,0 +332,0 @@ entry = this.entry(entry); |
@@ -19,3 +19,2 @@ "use strict"; | ||
exports.Log = void 0; | ||
const arrify = require("arrify"); | ||
const promisify_1 = require("@google-cloud/promisify"); | ||
@@ -25,2 +24,3 @@ const dotProp = require("dot-prop"); | ||
const entry_1 = require("./entry"); | ||
const instrumentation_1 = require("./utils/instrumentation"); | ||
const log_common_1 = require("./utils/log-common"); | ||
@@ -259,3 +259,11 @@ /** | ||
async write(entry, opts) { | ||
const isInfoAdded = instrumentation_1.getInstrumentationInfoStatus(); | ||
const options = opts ? opts : {}; | ||
// If instrumentation info was not added, means that this is first time | ||
// log entry is written and that the instrumentation log entry could be | ||
// generated for this request. If yes, then make sure we set partialSuccess, so entire | ||
// request will make it through and only oversized entries will be dropped | ||
if (!isInfoAdded) { | ||
options.partialSuccess = true; | ||
} | ||
// Extract projectId & resource from Logging - inject & memoize if not. | ||
@@ -265,4 +273,4 @@ await this.logging.setProjectId(); | ||
const resource = await this.getOrSetResource(options); | ||
// Extract & format additional context from individual entries. | ||
const decoratedEntries = this.decorateEntries(arrify(entry)); | ||
// Extract & format additional context from individual entries. Make sure to add instrumentation info | ||
const decoratedEntries = this.decorateEntries(instrumentation_1.populateInstrumentationInfo(entry)); | ||
this.truncateEntries(decoratedEntries); | ||
@@ -269,0 +277,0 @@ // Clobber `labels` and `resource` fields with WriteOptions from the user. |
{ | ||
"name": "@google-cloud/logging", | ||
"version": "9.8.3", | ||
"version": "9.9.0", | ||
"description": "Stackdriver Logging Client Library for Node.js", | ||
@@ -69,3 +69,3 @@ "keywords": [ | ||
"@types/extend": "^3.0.1", | ||
"@types/mocha": "^8.0.0", | ||
"@types/mocha": "^9.0.0", | ||
"@types/node": "^16.0.0", | ||
@@ -91,3 +91,3 @@ "@types/on-finished": "^2.3.1", | ||
"proxyquire": "^2.1.3", | ||
"sinon": "^13.0.0", | ||
"sinon": "^14.0.0", | ||
"ts-loader": "^9.0.0", | ||
@@ -94,0 +94,0 @@ "typescript": "^3.8.3", |
@@ -25,3 +25,7 @@ [//]: # "This README.md file is auto-generated, all changes to this file will be lost." | ||
For an interactive tutorial on using the client library in a Node.js application, click Guide Me: | ||
[![Guide Me](_static/guide-me.svg)](https://console.cloud.google.com/?walkthrough_id=logging__logging-nodejs) | ||
A comprehensive list of changes in each version may be found in | ||
@@ -28,0 +32,0 @@ [the CHANGELOG](https://github.com/googleapis/nodejs-logging/blob/main/CHANGELOG.md). |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
4011929
71
67400
310
24