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

Having an option to keep built-in attributes in the log #65

Open
YeminLi opened this issue Jun 25, 2024 · 2 comments
Open

Having an option to keep built-in attributes in the log #65

YeminLi opened this issue Jun 25, 2024 · 2 comments

Comments

@YeminLi
Copy link

YeminLi commented Jun 25, 2024

Hey, it would be great if there is an option that allows preserving built-in attributes (time, level, msg..) in the log.
So basically, instead of having logs like

2024-06-24T20:29:08Z INF this is a message key_1="1234" key_2=456

The log will looks like below with the new option.

time=2024-06-24T20:29:08Z level=INF msg="this is a message" key_1="1234" key_2=456

Let me know if this makes sense.
Maybe I can provide a PR if this looks ok.

@lmittmann
Copy link
Owner

That looks exactly like the format of the slog.TextHandler. Why not use that?

@YeminLi
Copy link
Author

YeminLi commented Jun 26, 2024

That looks exactly like the format of the slog.TextHandler. Why not use that?

Yes, you are right!
However, I still want to have some color in the log so it's slightly more readable.

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

No branches or pull requests

2 participants