We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Describe the bug I have types with useful string representations:
type ByteCount int // Note this could be a struct as well. func (b ByteCount) String() string { // Returns a human readable string like "3.4MB" }
With slog.TextHandler, their string representation is printed. With slog.JSONHandler, it's ignored (which is great).
slog.TextHandler
slog.JSONHandler
However, with devslog they are not shown at all:
To Reproduce
slog.Info("stats", "mem", ByteCount(9503159))
Results in
INFO stats # mem : 9503159
Expected behavior
INFO stats # mem : 9503159 "9.5MB"
Additional context
There are some variations to consider:
String
LogValuer
The text was updated successfully, but these errors were encountered:
Sorry for long silence. I like the second proposal, here is solution: #32 LogValuer always take precedence. I don't have solution for structs, yet.
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
Describe the bug
I have types with useful string representations:
With
slog.TextHandler
, their string representation is printed. Withslog.JSONHandler
, it's ignored (which is great).However, with devslog they are not shown at all:
To Reproduce
Results in
Expected behavior
Additional context
There are some variations to consider:
String
method?LogValuer
, which should probably take precedence.The text was updated successfully, but these errors were encountered: