You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to add a stack trace to the metadata only if lager:error() is called. I'm trying to use the dynamic metadata but since the function has zero arguments, I can't tell what level the current log is called with.
Is there a function I can call to see what the current log level is or is there a better hook to be called in the same process that lager:error() is called in?
The text was updated successfully, but these errors were encountered:
yulius-take2
changed the title
How to get log level in dynamic metadata
How to get log level in dynamic metadata?
May 20, 2022
It is way easier to do something like this from your own custom lager backend. Presumably you are capturing a stack trace from a call site. If so, you can ship it using lager:md/1, then in your backend, you can inspect lager_msg:severity(Message) and if it's higher than error, you can pull the stack trace from the metadata and inject it into the message to be emitted by lager.
I would like to add a stack trace to the metadata only if
lager:error()
is called. I'm trying to use the dynamic metadata but since the function has zero arguments, I can't tell what level the current log is called with.https://github.com/erlang-lager/lager#setting-dynamic-metadata-at-compile-time
Is there a function I can call to see what the current log level is or is there a better hook to be called in the same process that
lager:error()
is called in?The text was updated successfully, but these errors were encountered: