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
Err
logger = logger.WithGroup("group0").With("reqId", "xxxx-xxx-xxxx-xxxx") logger.WithGroup("group1").Debug("Debug msg", "foo", "bar", "x", "y") logger.Info("This is a info msg", "foo", 1, "bar", true) logger.Warn("This is a warn msg", "foo", map[string]string{"aa": "bb", "cc": "dd"}, "bar", []string{"a", "b", "c"}, "null response", nil) logger.Error("This is a error msg", tint.Err(errors.New("i'm an error")))
the expected output should be group0.group1.err
group0.group1.err
The text was updated successfully, but these errors were encountered:
I can not reproduce this issue with your code. Are you using the latest version of tint (v1.0.2)?
tint
v1.0.2
Sorry, something went wrong.
yes, i'm using v1.0.2
here is the whole code
package logging import ( "errors" "log/slog" "os" "testing" "time" "github.com/lmittmann/tint" ) func TestLogging(t *testing.T) { lh := tint.NewHandler(os.Stdout, &tint.Options{ Level: slog.LevelDebug, TimeFormat: time.Kitchen, AddSource: true, }) logger := slog.New(lh) slog.SetDefault(logger) logger = logger.WithGroup("group0").With("reqId", "xxxx-xxx-xxxx-xxxx") logger.WithGroup("group1").Debug("Debug msg", "foo", "bar", "x", "y") logger.Info("This is a info msg", "foo", 1, "bar", true) logger.Warn("This is a warn msg", "foo", map[string]string{"aa": "bb", "cc": "dd"}, "bar", []string{"a", "b", "c"}, "null response", nil) logger.Error("This is a error msg", tint.Err(errors.New("i'm an error"))) }
fixed #44
bc0eefd
Fixed wrong group prefix for error attribute (#45)
0c0d0cf
* added test case * fixed #44 --------- Co-authored-by: lmittmann <[email protected]>
lmittmann
Successfully merging a pull request may close this issue.
the expected output should be
group0.group1.err
The text was updated successfully, but these errors were encountered: