Skip to content

Commit

Permalink
fix: log attrs being dropped (#2168)
Browse files Browse the repository at this point in the history
- Fixes #2167
  • Loading branch information
wesbillman authored Jul 25, 2024
1 parent 9201184 commit bbe565d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion internal/log/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,13 @@ func (l *Logger) Log(entry Entry) {
if entry.Time.IsZero() {
entry.Time = time.Now()
}
entry.Attributes = l.attributes

// merge logger and entry attributes
mergedAttributes := make(map[string]string)
maps.Copy(mergedAttributes, l.attributes)
maps.Copy(mergedAttributes, entry.Attributes)
entry.Attributes = mergedAttributes

if err := l.sink.Log(entry); err != nil {
fmt.Fprintf(os.Stderr, "ftl:log: failed to log entry: %v", err)
}
Expand Down

0 comments on commit bbe565d

Please sign in to comment.