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

feat(zapslog): implement stack trace handling #1339

Merged
merged 18 commits into from
Sep 1, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
option: Drop AddCaller
We don't need AddCaller and WithCaller both.
WithCaller was added because AddCaller doesn't take a parameter.
  • Loading branch information
abhinav authored and zekth committed Aug 25, 2023
commit 46f52288816e76c1f9d749ada5700769c7158201
2 changes: 1 addition & 1 deletion exp/zapslog/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import (

func TestAddCaller(t *testing.T) {
fac, logs := observer.New(zapcore.DebugLevel)
sl := slog.New(NewHandler(fac, AddCaller()))
sl := slog.New(NewHandler(fac, WithCaller(true)))
sl.Info("msg")

require.Len(t, logs.AllUntimed(), 1, "Expected exactly one entry to be logged")
Expand Down
10 changes: 2 additions & 8 deletions exp/zapslog/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,9 @@ func WithName(name string) Option {
})
}

// AddCaller configures the Logger to annotate each message with the filename,
// line number, and function name of zap's caller. See also WithCaller.
func AddCaller() Option {
return WithCaller(true)
}

// WithCaller configures the Logger to annotate each message with the filename,
// line number, and function name of zap's caller, or not, depending on the
// value of enabled. This is a generalized form of AddCaller.
// line number, and function name of Zap's caller, or not, depending on the
// value of enabled.
func WithCaller(enabled bool) Option {
return optionFunc(func(handler *Handler) {
handler.addCaller = enabled
Expand Down