[erlang-questions] proper way to use the new logger

Nicolas Martyanoff khaelin@REDACTED
Wed Aug 29 18:01:45 CEST 2018


I have been trying to use the new logger application, and I am not sure about
the way I am supposed to configure it for my needs (keep in mind that I am an
Erlang beginner, hoping to use Erlang in production someday).

During development of a "library", i.e. an OTP application used by the program
I am working on, I need to see all logs related to the modules which are part
of the OTP application. However I cannot see how to set the log level to
`debug` for these modules only (and not globally with `{logger_level,
debug}`). Ideally, there would be a way to configure it in a local sys.config
to get this effect only during development, without having to do it
programmatically in every module I work on.

More importantly, I can't seem to find a way to include the name of the module
in log messages, either in the formatter template or anywhere else. Am I
supposed to add it manually to every single logger message I write ?

I am just trying to find a simple way to add log instructions to the code I
write, with the possibility to control which ones are printed depending on the
environment (local library development, application development, tests,
production...) using settings in sys.config.

Thank you in advance.

Nicolas Martyanoff

More information about the erlang-questions mailing list