Skip to content

Commit

Permalink
fix: add check keyVals invalid
Browse files Browse the repository at this point in the history
  • Loading branch information
hoank101 committed Jun 20, 2024
1 parent 6385030 commit 9ca00d8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions mod/log/pkg/phuslu/phuslu.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,11 @@ func (l Logger[ImplT]) With(keyVals ...any) ImplT {

// Add the new context to the existing context.
for i := 0; i < len(keyVals); i += 2 {
key, val := keyVals[i].(string), keyVals[i+1]
newLogger.context[key] = val
key, ok := keyVals[i].(string)
if !ok {
continue
}
newLogger.context[key] = keyVals[i+1]
}

return any(&newLogger).(ImplT)
Expand Down

0 comments on commit 9ca00d8

Please sign in to comment.