[erlang-questions] Conditional configuration?
David Welton
davidnwelton@REDACTED
Fri May 30 11:09:44 CEST 2014
Chicago Boss copies a handy idea from Rails, which copied it from
somewhere else in turn: having different "environments", such as
development, production and testing.
Is it possible to conditionally do things in an Erlang configuration
file? I get the impression it is not.
What I'd like to accomplish:
{lager,
[{error_logger_hwm, 100},
{handlers,
[{lager_console_backend, info},
{lager_syslog_backend,
["gsd_web", daemon, info,
{lager_default_formatter, [date, " ", time, " [", severity, "]
", module, " ", pid, " ", message, "\n"]}
]},
%% ^^^^^ only in production mode
{lager_file_backend, [{file, "log/error.log"}, {level, error}]},
{lager_file_backend,
[{file, "log/console.log"},
{level, info},
{formatter, lager_default_formatter},
{formatter_config, [date, " ", time, " [", severity, "] ",
module, " ", pid, " ", message, "\n"]}
]}
]}
%% ^^^^ runs only in development mod
]}
Ideas on how to best accomplish this?
Thanks
--
David N. Welton
http://www.welton.it/davidw/
http://www.dedasys.com/
More information about the erlang-questions
mailing list