-
Notifications
You must be signed in to change notification settings - Fork 620
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
Comments
I can take this one and check out possibilities for a JSONHandler |
💯 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 |
The JSON logging PR has been merged now, could we consider this issue closed? |
Thanks, @syhol! |
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 toConsoleHandler
, 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.
The text was updated successfully, but these errors were encountered: