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

JSON support in loggers #3394

Closed
tmcw opened this issue May 23, 2023 · 4 comments
Closed

JSON support in loggers #3394

tmcw opened this issue May 23, 2023 · 4 comments
Labels

Comments

@tmcw
Copy link

tmcw commented May 23, 2023

Is your feature request related to a problem? Please describe.

Logging services - in my case logtail - are increasingly involved in parsing logs and giving access to structured logs. The most straightforward option is to log JSON, though some also support logfmt.

The Deno logging module is great, but it doesn't work for logging JSON: at an early stage, it stringifies anything that is logged:

https://deno.land/std@0.188.0/log/logger.ts?source#L95

Describe the solution you'd like

I'd prefer the stringify step in the logging module to be at the handler stage, not at the logger stage, so that a JSONHandler, similar to ConsoleHandler, could be written in userspace.

Describe alternatives you've considered

There are other logging modules, but it'd be nice to use the Deno-std one.

@luk3skyw4lker
Copy link
Contributor

I can take this one and check out possibilities for a JSONHandler

@osdevisnot
Copy link

💯 This is especially relevant now that #golang added https://pkg.go.dev/log/slog for structured logging. Also, it seems the std logger is slightly unconventional to use warning instead of warn method; the latter of which is more common in javascript.

@syhol
Copy link
Contributor

syhol commented Dec 18, 2023

The JSON logging PR has been merged now, could we consider this issue closed?

@iuioiua
Copy link
Contributor

iuioiua commented Dec 18, 2023

Thanks, @syhol!

@iuioiua iuioiua closed this as completed Dec 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants