logger_file_backend
logger_file_backend copied to clipboard
How to set format on backends?
I am not sure whether this is an issue or a question.
Below is my configuration which works fine:
config :logger, backends: [{LoggerFileBackend, :error_log}]
Now I want to add a format for the log and I am not sure how to do that. I tried a few configuration but none of them work as below. How can I configure the format?
config :logger, backends: [{LoggerFileBackend, :error_log, format: "\n$date $time $metadata $levelpad$message\n"}]
config :logger, backends: [{LoggerFileBackend, :error_log}],
format: "\n$date $time $metadata $levelpad$message\n"
The second item in the backend declaration pair is the name of the backend, in the case of LoggerFileBackend
.
In order to configure the LoggerFileBackend : error_log
, for example, one could do the following:
config :logger, backends: [{LoggerFileBackend, :error_log}]
config :logger, :error_log,
format: "\n$date $time $metadata $levelpad$message\n"