Skip to content
This repository has been archived by the owner on Jul 31, 2023. It is now read-only.

Logs #80

Open
deadtrickster opened this issue Apr 1, 2018 · 5 comments
Open

Logs #80

deadtrickster opened this issue Apr 1, 2018 · 5 comments
Assignees

Comments

@deadtrickster
Copy link
Member

This was asked on Gitter and I decided to describe how we do this and start discussion of possible directions.

We

  • use lager;
  • mainly use ocp;
  • log with tags - here a simple macro wrapper was needed so the tags context doesn't pollute logging code. Tags are prepended to the original log message;
  • log spans to a special lager sink. This means we can manage this stream independently from defaults. We log spans when they created iff "log" attribute is present. At first we logged spans in a special reporter but decided to use macros again and log synchronously;

I'm ok with lager (esp sinks) and would like to have logging here directly:

{lager_extra_sinks, [oc_log]}
  • oc_log:/1,2,3 - just like lager:level but prepends tags (can be filtered I guess);
  • something for logging spans :-), perhaps hook to oc_trace:start_span/finish_span.
@deadtrickster
Copy link
Member Author

From slack - @tsloughter: "I've been wanting to add docs about tags use with lager metadata".

@tsloughter
Copy link
Member

Here's the lager docs on what I was thinking of https://github.com/erlang-lager/lager/#setting-dynamic-metadata-at-compile-time

@tsloughter
Copy link
Member

Investigating this more, and not wanting to require lager, I think the best option is to wait for the new OTP logger and use it to set the metadata when a span is created. Hopefully this will be OTP 21.

@tsloughter
Copy link
Member

Just to update this thread, now on OTP-21 the logger metadata will be set to include the trace and span ids.

Next I'll add information to the readme at least about how to use them in logger's default formatter.

@hauleth
Copy link
Contributor

hauleth commented Dec 7, 2018

I think we can close it now as support for that landed via supporting OTP 21 logger.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants