Here's a minimal setup for lager with Elixir:
# mix.exs
def application do
[
applications: [:lager],
erl_opts: [parse_transform: "lager_transform"]
]
end
defp deps do
[{:lager, github: "basho/lager"}]
end
# config/config.exs
config :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]
]
As you can see, the log_root
option will allow you to set a log directory at compile time. I've recreated the example configuration from the lager docs above, you should be able to take it from here and specify the configuration options you need.
There's no way to change the log directory and/or log level during runtime, which I reckon is one of the downsides of lager. I have no experience with tracing but the example above should enable you to set the necessary config options.