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

[Bug]: Logger is required for profiler #2432

Open
MarkMurphy opened this issue Mar 20, 2024 · 0 comments
Open

[Bug]: Logger is required for profiler #2432

MarkMurphy opened this issue Mar 20, 2024 · 0 comments

Comments

@MarkMurphy
Copy link

🔎 Search Terms

Logger is required for profiler

The problem

Upgraded Winston to 3.12.0 and my tests started failing with an error coming from Winston: "Error: Logger is required for profiler"

I have a process that calls logger.startTimer(), where logger is a child logger of another created via the createLogger method.

This code seems to be the source of the error:

if (typeof logger !== 'object' || Array.isArray(logger) || !(logger instanceof Logger)) {

My child logger instance's class is DerivedLogger, performing the same checks as the code above I get:

console.log(
  typeof logger !== 'object',
  Array.isArray(logger),
  !(logger instanceof Logger),
)

Produces false, false, false

console.log(typeof logger, require('util').inspect(logger))

Produces object, DerivedLogger {}

I believe this was introduced via #2226

What version of Winston presents the issue?

v3.12.0

What version of Node are you using?

v20.11.1

If this worked in a previous version of Winston, which was it?

No response

Minimum Working Example

No response

Additional information

No response

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

No branches or pull requests

1 participant