To generate logs:
Logger.info "Completed operation A"
Logger.debug fn -> inspect(somevar) end
Logger.error "Some exception #{somexception} occured"
For projects generated with Mix
, you can specify some options in config/config.exs
:
use Mix.Config
config :logger,
backends: [:console] # default, support for additional log sinks
compile_time_purge_level: :info # purges logs with lower level than this
A full range options are available in the official Logger documentation.
Additional reading: