-
Notifications
You must be signed in to change notification settings - Fork 1
serve slog #180
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
serve slog #180
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,6 +40,7 @@ type AppLogger interface { | |
| Debug(message string, fields ...Field) | ||
| Fatal(message string, err error, fields ...Field) | ||
| With(fields ...Field) AppLogger | ||
| Slog() *slog.Logger | ||
| } | ||
|
|
||
| // SLogger is an implementation of AppLogger backed by slog. | ||
|
|
@@ -129,6 +130,11 @@ func (l *SLogger) With(fields ...Field) AppLogger { | |
| return &SLogger{logger: l.logger.With(prepareSlogParams(nil, fields)...)} | ||
| } | ||
|
|
||
| // Slog return native slogger | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win Remove the restating comment. The comment does not document non-obvious behavior. Remove it unless this method has a protocol contract that requires explanation. As per path instructions, comments are only for non-obvious business logic or protocol details. 🤖 Prompt for AI AgentsSource: Path instructions
abergasov marked this conversation as resolved.
Outdated
|
||
| func (l *SLogger) Slog() *slog.Logger { | ||
| return l.logger | ||
| } | ||
|
abergasov marked this conversation as resolved.
|
||
|
|
||
| func prepareSlogParams(err error, fields []Field) []any { | ||
| params := make([]any, 0, len(fields)+2) | ||
| if err != nil { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.