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

Log Attrs getting dropped when new loggers are created #2167

Closed
wesbillman opened this issue Jul 25, 2024 · 0 comments · Fixed by #2168
Closed

Log Attrs getting dropped when new loggers are created #2167

wesbillman opened this issue Jul 25, 2024 · 0 comments · Fixed by #2168
Assignees

Comments

@wesbillman
Copy link
Collaborator

If new loggers with scope and/or attrs are created, the new values are not being recorded as part of the log entry.

// Time returns the current time.
//
//ftl:verb export
func Time(ctx context.Context, req TimeRequest) (TimeResponse, error) {
	logAttrs := map[string]string{"keya": "a", "keyb": "b"}
	logger := ftl.LoggerFromContext(ctx).Scope("new_scope").Attrs(logAttrs)
	logger.Infof("Time request received")
	return TimeResponse{Time: time.Now()}, nil
}

The expected attributes would be:

{
  "deployment": "<whatever key>",
  "keya": "a",
  "keyb": "b",
  "module": "time",
  "scope": "new_scope"
}

But we're getting:

{
  "deployment": "<whatever key>",
  "module": "time",
  "scope": "time"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant