Hello all!
I have a project that I have been working on. I have been using function calls such as logger:info/2
, logger:debug/2
, etc. but have been wanting to add more metadata info. I don’t understand how to make this work, however. I want to set this in the kernel config. Currently I have this:
[{kernel,
[{logger_level, ${LOGLEVEL}},
{logger,
[{handler, my_std_h, logger_std_h,
#{ config => #{ file => "/home/${USER}/log/erlang.log",
max_no_bytes => 1024000,
max_no_files => 5},
formatter => {logger_formatter, #{template => [time," [",level,"]: ",msg,"\n"], single_line => false}}}}]}]}
].
To my understanding, I should be able to put another tuple in the list with the logger_metadata
atom as well as a map…but the map part is confusing me. If I want, say, mfa and pid, how is this going to work? The mfa and pid are different each time something like ?LOG
would be called.
I’m probably not making much sense. So the question is: how can I configure my config file and logger_formatter
template to include metadata? I really can’t understand the documentaiton