Is it possible to combine the capabilities of a FormatLogger
and of a FileLogger
in LoggingExtras.jl
?
Quite obviously, the first one helps formatting logging messages with the other sends them to appropriate files. Though I can’t figure how to use both capabilities at the same time.
Here is an example of a logger using the package documentation
function init_logger()
# fmt_logger = FormatLogger() do io,args
# println(io,args._module," | ","[",args.level,"] ",args.message)
# end
logger = TeeLogger(
global_logger(),
MinLevelLogger(FileLogger("info.log"), Logging.Info),
MinLevelLogger(FileLogger("warn.log"), Logging.Warn),
MinLevelLogger(FileLogger("error.log"), Logging.Error),
)
return logger
end
logger = init_logger()
with_logger(logger) do
@info "blablabla"
@warn "bliblibli"
@error "blobloblo"
end