Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

winston:create-logger diagnostic cannot be turned off #1715

Open
1 of 2 tasks
esetnik opened this issue Oct 9, 2019 · 7 comments
Open
1 of 2 tasks

winston:create-logger diagnostic cannot be turned off #1715

esetnik opened this issue Oct 9, 2019 · 7 comments

Comments

@esetnik
Copy link

esetnik commented Oct 9, 2019

Please tell us about your environment:

  • winston version?
    • winston@2
    • winston@3
  • node -v outputs: v10.16.3
  • Operating System? (Windows, macOS, or Linux) macOS
  • Language? (all | TypeScript X.X | ES6/7 | ES5 | Dart) Typescript

What is the problem?

import winston from 'winston';

const logger = winston.createLogger({
  level: 'debug',
  format: winston.format.json(),
  transports: [new winston.transports.Console()],
});

export default logger;

In the console I see a lot of messages coming from the diagnostic logger.

winston:create-logger Define prototype method for "error"
winston:create-logger Define prototype method for "warn"
winston:create-logger Define prototype method for "info"
winston:create-logger Define prototype method for "http"
winston:create-logger Define prototype method for "verbose"
winston:create-logger Define prototype method for "debug"
winston:create-logger Define prototype method for "silly"
winston:create-logger Define prototype method for "error"
winston:create-logger Define prototype method for "warn"
winston:create-logger Define prototype method for "info"
winston:create-logger Define prototype method for "http"
winston:create-logger Define prototype method for "verbose"
winston:create-logger Define prototype method for "debug"
winston:create-logger Define prototype method for "silly"
winston:create-logger Define prototype method for "error"
winston:create-logger Define prototype method for "warn"
winston:create-logger Define prototype method for "info"
winston:create-logger Define prototype method for "http"
winston:create-logger Define prototype method for "verbose"
winston:create-logger Define prototype method for "debug"
winston:create-logger Define prototype method for "silly"
winston:create-logger Define prototype method for "error"
winston:create-logger Define prototype method for "warn"
winston:create-logger Define prototype method for "info"
winston:create-logger Define prototype method for "http"
winston:create-logger Define prototype method for "verbose"
winston:create-logger Define prototype method for "debug"
winston:create-logger Define prototype method for "silly"

What do you expect to happen instead?

I expected none of these internal winston debug messages in my console. I tried using DEBUG=-winston:create-logger and DIAGNOSTIC=-winston:create-logger but neither worked.

Other information

I saw another user report the same issue https://gitter.im/winstonjs/winston/archives/2017/11/22
And another user report the same issue https://stackoverflow.com/questions/55573448/disable-winstons-verbose-startup-logs

@esetnik
Copy link
Author

esetnik commented Oct 9, 2019

I believe this is caused by 3rd-Eden/diagnostics#20

@Nhilesh
Copy link

Nhilesh commented Jun 14, 2020

This is caused by line no 54 in 'create-logger.js' where the developer has kept a debug line open for us.

debug('Define prototype method for "%s"', level);

I did comment this line manually and the problem is solved.

@RandyZ
Copy link

RandyZ commented Nov 7, 2020

Same question

@jcollum
Copy link

jcollum commented Jan 27, 2021

We are also having an issue with that line. Commenting it out is not an option, realistically.

@rsgilbert
Copy link

I can confirm that setting: DEBUG=-winston:create-logger in your .env file works.

@robblovell
Copy link

None of the following .env lines removes this debug output in [email protected] nor [email protected]. Setting env on the command line does not work either.

DIAGNOSTICS=-winston:*
DEBUG=-winston:*
DIAGNOSTICS=-winston:create-logger:*
DEBUG=-winston:create-logger:*
DIAGNOSTICS=-winston:create-logger
DEBUG=-winston:create-logger
DIAGNOSTICS=-*
DEBUG=-*

Perhaps the act of initializing Winston in our code, or the Winston code itself, somehow negates the environment variables?

@DABH
Copy link
Contributor

DABH commented Feb 22, 2024

Are you using the @dabh/diagnostics package in any other part of your repo? Are you using winston from somewhere where process.env isn't available? https://github.com/DABH/diagnostics?tab=readme-ov-file#adapters Haven't seen others report this issue so thinking it must be something special about your env or setup...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants