nodejs-logging-winston
nodejs-logging-winston copied to clipboard
Using Winston logging library locally (on MAC) prints same error too many times when cloud credentials are not provided
- Is this a client library issue or a product issue? When running locally on my MAC, I got too many errors:
(node:11479) UnhandledPromiseRejectionWarning: Error: Unable to detect a Project Id in the current environment.
Ideally this should be printed only once as warning and ignored later, since otherwise logs printed into console become a mess. Also worth mentioning that locally I might not need to use any project ID if I don't want to use Cloud Logging, so printing warning once good enough.
-
Did someone already solve this? No
-
Do you have a support contract? No
Environment details
- OS: Mac
- Node.js version: v14.17.6
- npm version: 6.14.15
-
@google-cloud/logging-winstonversion: ^4.1.1
Steps to reproduce
Just create logger by code below and use it by callingAPIs like logger.info while credentials are not set, e.g.:
function createLogger() {
return winston.createLogger({
level: 'info',
transports: [
new winston.transports.Console(),
// Add Stackdriver Logging
new LoggingWinston(),
],
});
}