Skip to content

Switch human logger from JSON to logfmt #170

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

Merged
merged 14 commits into from
May 9, 2023
Merged

Switch human logger from JSON to logfmt #170

merged 14 commits into from
May 9, 2023

Conversation

ammario
Copy link
Member

@ammario ammario commented May 8, 2023

new:
Screenshot 2023-05-08 at 8 34 27 PM

old:
Screenshot 2023-05-08 at 2 45 36 PM


cc @nhooyr, see coder/coder#7451 for context.

ammario added 5 commits May 7, 2023 18:44
This format is consistent with Go's new official `slog`, `zerolog`
and many others. It is also far more readable than JSON, and a growing
number of libaries and tools are able to parse it.
@ammario ammario requested a review from coadler May 8, 2023 19:47
@ammario ammario force-pushed the human branch 9 times, most recently from 489613f to 7441aa7 Compare May 8, 2023 20:32
@ammario ammario requested review from kylecarbs and removed request for coadler May 8, 2023 20:56
@ammario ammario merged commit 68327e2 into main May 9, 2023
@ammario ammario deleted the human branch May 9, 2023 02:47
@nhooyr
Copy link
Contributor

nhooyr commented May 9, 2023

The lack of syntax highlighting makes me really sad :(

@alixander
Copy link

alixander commented May 9, 2023

i just upgraded deps and was surprised at this change, which led me here. just noting that for me, JSON as a slog field is no longer readable.

Old:

Screen Shot 2023-05-08 at 10 42 10 PM

New:

Screen Shot 2023-05-08 at 10 41 48 PM

anyway, we can just peg to old version, or is there a config to switch to JSON again @nhooyr ?

@nhooyr
Copy link
Contributor

nhooyr commented May 9, 2023

@alixander just peg to old version. This change wasn't made in consultation with me. I disagree with it.

@ammario
Copy link
Member Author

ammario commented May 9, 2023

@alixander and @nhooyr — sorry for the abrupt merge, I should've kept this open for longer.

This raises a good moment to discuss the future of this project. Is the lack of JSON highlighting your main issue with the change, or is Coder's general goal of moving towards stdlib slog against your's?

@coadler
Copy link
Contributor

coadler commented May 9, 2023

Could we just have different sloggers for the old human fmt and logfmt?

@nhooyr
Copy link
Contributor

nhooyr commented May 10, 2023

I'd prefer @coadler's suggestion for now. If this new slogger came in a different package that's cool, I'm not opposed to more options and supporting stdlib slog seems like a good idea on the face of it.

I'm not too familiar with the stlib slog. I'm in Ontario right now visiting my ailing mum. I don't have the time right now to look into it or the issue you made at coder/coder#7451. When I get back to Kaslo I'll look into it.

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

Successfully merging this pull request may close these issues.

5 participants