@google-cloud/logging-winston
Advanced tools
Comparing version 4.0.2 to 4.0.3
@@ -25,11 +25,18 @@ "use strict"; | ||
let transport; | ||
// If a transport was not provided, instantiate one. | ||
if (!(optionsOrTransport instanceof index_1.LoggingWinston)) { | ||
// If no custom transports are provided, use default or instantiate one. | ||
const cloudTransport = logger.transports.find(t => t instanceof index_1.LoggingWinston); | ||
// If user provides a custom transport, always add it to the logger. | ||
if (optionsOrTransport instanceof index_1.LoggingWinston) { | ||
transport = optionsOrTransport; | ||
logger.add(transport); | ||
} | ||
else if (cloudTransport && !optionsOrTransport) { | ||
// Check if logger already contains a Cloud transport | ||
transport = cloudTransport; | ||
} | ||
else { | ||
const options = { logName: 'winston_log', ...optionsOrTransport }; | ||
transport = new index_1.LoggingWinston(options); | ||
logger.add(transport); | ||
} | ||
else { | ||
transport = optionsOrTransport; | ||
} | ||
logger.add(transport); | ||
const auth = transport.common.stackdriverLog.logging.auth; | ||
@@ -36,0 +43,0 @@ const [env, projectId] = await Promise.all([ |
@@ -7,2 +7,9 @@ # Changelog | ||
### [4.0.3](https://www.github.com/googleapis/nodejs-logging-winston/compare/v4.0.2...v4.0.3) (2021-01-21) | ||
### Bug Fixes | ||
* dedupe logs when using middleware ([#553](https://www.github.com/googleapis/nodejs-logging-winston/issues/553)) ([34c9a47](https://www.github.com/googleapis/nodejs-logging-winston/commit/34c9a47e19420b2163b86862732b75a1275e37c9)) | ||
### [4.0.2](https://www.github.com/googleapis/nodejs-logging-winston/compare/v4.0.1...v4.0.2) (2020-12-08) | ||
@@ -9,0 +16,0 @@ |
{ | ||
"name": "@google-cloud/logging-winston", | ||
"description": "Stackdriver Logging transport for Winston", | ||
"version": "4.0.2", | ||
"version": "4.0.3", | ||
"license": "Apache-2.0", | ||
@@ -6,0 +6,0 @@ "author": "Google Inc.", |
@@ -271,4 +271,3 @@ [//]: # "This README.md file is auto-generated, all changes to this file will be lost." | ||
Samples are in the [`samples/`](https://github.com/googleapis/nodejs-logging-winston/tree/master/samples) directory. The samples' `README.md` | ||
has instructions for running the samples. | ||
Samples are in the [`samples/`](https://github.com/googleapis/nodejs-logging-winston/tree/master/samples) directory. Each sample's `README.md` has instructions for running its sample. | ||
@@ -275,0 +274,0 @@ | Sample | Source Code | Try it | |
92932
669
346