Skip to content

Commit

Permalink
refactor: Using LogAttrs
Browse files Browse the repository at this point in the history
Signed-off-by: Vincent Boutour <bob@vibioh.fr>
  • Loading branch information
ViBiOh committed Jan 28, 2024
1 parent a6f55ad commit 81ef937
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/concurrent/concurrent.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package concurrent

import (
"context"
"fmt"
"log/slog"
"runtime/debug"
Expand All @@ -23,7 +24,7 @@ func (g *Simple) Go(f func()) {

defer func() {
if r := recover(); r != nil {
slog.Error(fmt.Sprintf("panic: %s", r), "error.stack", string(debug.Stack()))
slog.LogAttrs(context.Background(), slog.LevelError, fmt.Sprintf("panic: %s", r), slog.String("error.stack", string(debug.Stack())))
}
}()

Expand Down

0 comments on commit 81ef937

Please sign in to comment.