Open yulius-take2 opened 2 years ago
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?