Skip to content

Add correlation to logs #792

@madshov

Description

@madshov

Hi!
I would be nice to be able to add a correlation-id per request to all logs including the ones created in ServeHTTP method. Currently errors returned from an endpoint will not have any correlation-id:

response, err := s.e(ctx, request)
if err != nil {
	s.logger.Log("err", err)
	s.errorEncoder(ctx, err, w)
	return
}

It could just be the request-id from the context. I don't see how it's possible to add it in these cases. If it can be done, I would appreciate, if you would let me know.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions