Reputation: 2495
In Java Development, we did debug checking before logging a time / memory consuming operation.
for example:
if(log.isDebugEnabled()){
log.debug("This is time / memory consuming {}", bigString);
}
with Erlang Lager, Do I need to do the same check before logging it?
If yes, how to check this?
Upvotes: 1
Views: 576
Reputation: 12557
With lager, you can change desired log level with lager configuration, so you can omit any check in the code. If debug level is not enabled for any backend, it will be just dropped
See example
{lager, [
{log_root, "/var/log/hello"},
{handlers, [
{lager_console_backend, info},
{lager_file_backend, [{file, "error.log"}, {level, error}]},
{lager_file_backend, [{file, "console.log"}, {level, info}]}
{lager_file_backend, [{file, "debug.log"}, {level, debug}]}
]}
]}.
So debug logs will only go to debug.log
Upvotes: 1