googleapis / nodejs-logging-winston

Node.js client integration between Stackdriver Logging and Winston.
https://cloud.google.com/logging/
Apache License 2.0
106 stars 50 forks source link

Unknown log level : http #757

Closed bottom-up-ai closed 1 year ago

bottom-up-ai commented 1 year ago

Environment details

Steps to reproduce

  1. Log anything with the log level 'http' from winston while connected to google cloud logging

Produce the following error :

Error: Unknown log level: http
    at LoggingCommon.log (C:\Users\Louis\Documents\spotify-portfolio\server\node_modules\@google-cloud\logging-winston\build\src\common.js:123:19)
    at LoggingWinston.log (C:\Users\Louis\Documents\spotify-portfolio\server\node_modules\@google-cloud\logging-winston\build\src\index.js:120:21)
    at LoggingWinston._writev (C:\Users\Louis\Documents\spotify-portfolio\server\node_modules\winston-transport\index.js:134:12)
    at doWrite (C:\Users\Louis\Documents\spotify-portfolio\server\node_modules\readable-stream\lib\_stream_writable.js:409:97)
    at clearBuffer (C:\Users\Louis\Documents\spotify-portfolio\server\node_modules\readable-stream\lib\_stream_writable.js:505:5)
    at onwrite (C:\Users\Louis\Documents\spotify-portfolio\server\node_modules\readable-stream\lib\_stream_writable.js:455:7)
    at WritableState.onwrite (C:\Users\Louis\Documents\spotify-portfolio\server\node_modules\readable-stream\lib\_stream_writable.js:160:5) 
    at newCallback (C:\Users\Louis\Documents\spotify-portfolio\server\node_modules\@google-cloud\logging-winston\build\src\common.js:223:21)
    at C:\Users\Louis\Documents\spotify-portfolio\server\node_modules\@google-cloud\promisify\build\src\index.js:113:13 Promise {
  <rejected> Error: Unknown log level: http
      at LoggingCommon.log (C:\Users\Louis\Documents\spotify-portfolio\server\node_modules\@google-cloud\logging-winston\build\src\common.js:123:19)
      at LoggingWinston.log (C:\Users\Louis\Documents\spotify-portfolio\server\node_modules\@google-cloud\logging-winston\build\src\index.js:120:21)
      at LoggingWinston._writev (C:\Users\Louis\Documents\spotify-portfolio\server\node_modules\winston-transport\index.js:134:12)
      at doWrite (C:\Users\Louis\Documents\spotify-portfolio\server\node_modules\readable-stream\lib\_stream_writable.js:409:97)
      at clearBuffer (C:\Users\Louis\Documents\spotify-portfolio\server\node_modules\readable-stream\lib\_stream_writable.js:505:5)
      at onwrite (C:\Users\Louis\Documents\spotify-portfolio\server\node_modules\readable-stream\lib\_stream_writable.js:455:7)
      at WritableState.onwrite (C:\Users\Louis\Documents\spotify-portfolio\server\node_modules\readable-stream\lib\_stream_writable.js:160:5)
      at newCallback (C:\Users\Louis\Documents\spotify-portfolio\server\node_modules\@google-cloud\logging-winston\build\src\common.js:223:21)
      at C:\Users\Louis\Documents\spotify-portfolio\server\node_modules\@google-cloud\promisify\build\src\index.js:113:13

This is the only log level where there is an error !

Thanks guys!

losalex commented 1 year ago

Thanks @bottom-up-ai for opening this issue. I created PR to address this problem - please let me know if thats what you were looking for

bottom-up-ai commented 1 year ago

Thank you for your response.

It seems to be fixed, I pulled the latest version "5.2.1" and it works without any bug.

The only problem now, is that I'm not seeing the "http" log inside Google cloud platform logging.

I tried replacing the "http" log request with an "info" log, the "log" request shows up in the console, but not the "http".

losalex commented 1 year ago

@bottom-up-ai, does it means that record logged with http is dropped completely or logged with different severity? Based on our code we have to translate npm levels into LogSeverity. Looking into documentation, we do not have HTTP in LogSeverity and hence we translate it to one of existing severities.

bottom-up-ai commented 1 year ago

It is dropped completely.

I tried it again, with winston logging the http request configured with morgan, and it's not showing in Google cloud logging.

When I set the severity back to info, it is shown in Google cloud logging.

losalex commented 1 year ago

Thanks @bottom-up-ai for reply! Would you be able to share a snippet of code you using to repro a problem?

daniel-sanche commented 1 year ago

I'm closing this due to inactivity, since it seems like the main issue was fixed.

Feel free to re-open if you're still having issues