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]: logging "err:" without any context #2400

Open
MarcusHSmith opened this issue Jan 18, 2024 · 6 comments
Open

[Bug]: logging "err:" without any context #2400

MarcusHSmith opened this issue Jan 18, 2024 · 6 comments

Comments

@MarcusHSmith
Copy link

🔎 Search Terms

error logging

The problem

export const ddLogger = createLogger({
  level: 'info',
  exitOnError: false,
  format: format.json(),
  transports: [new transports.Http(httpTransportOptions)],
})

we utilize ddLogger.info and ddLogger.error.

We transport to our Datadog instance.

In Datadog we're receiving tons of logs that are just "err:".

Where could they be coming from?

Screenshot 2024-01-18 at 14 58 05

What version of Winston presents the issue?

3.9.0

What version of Node are you using?

v16.18.1

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

No response

Minimum Working Example

No response

Additional information

No response

@paul-uz
Copy link

paul-uz commented Jan 30, 2024

I am seeing this as well in the latest version. I have a console.error in a catch block, and the logs show an error log, with no content

@paul-uz
Copy link

paul-uz commented Jan 30, 2024

Hmm, seems you can't just pass an error object to the error log method, it has to be a string :(

@paul-uz
Copy link

paul-uz commented May 31, 2024

Any updates on this? I need JSON format because the simple format doesn't output objects properly.

@DABH
Copy link
Contributor

DABH commented Jun 8, 2024

If it’s an issue that the error object has to be a string, maybe make a pr that allows it to be an Error or a string? That would probably be easy and backward compatible and not hurt performance materially

@paul-uz
Copy link

paul-uz commented Jun 8, 2024

I really wish I had time to contribute to libraries like this. I should probably try and make the effort seeing how much I complain about things but sadly I'm too busy with programming for work that contributing simply isn't cost/time effective currently.

Being brutally honest, something like this, I expect to work out of the box.

JSON formatting shoukd be able to handle error objects.

@whargrave-bjss
Copy link

@paul-uz I am testing this now but am able to get an error message with a Json response. What block of code are you using to get this issue?

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

4 participants