25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-20 17:27:00 +01:00

Bump lager version

This is needed for OTP-21 compatibility
This commit is contained in:
Evgeny Khramtsov 2018-09-07 18:03:36 +03:00
parent 79c511a441
commit 145c0116bf
2 changed files with 13 additions and 2 deletions

View File

@ -19,7 +19,7 @@
%%%----------------------------------------------------------------------
{deps, [{lager, ".*", {git, "https://github.com/erlang-lager/lager",
{tag, {if_version_above, "17", "3.4.2", "3.2.1"}}}},
{tag, {if_version_above, "17", "3.6.5", "3.2.1"}}}},
{p1_utils, ".*", {git, "https://github.com/processone/p1_utils", "6ff85e8"}},
{cache_tab, ".*", {git, "https://github.com/processone/cache_tab", {tag, "1.0.14"}}},
{fast_tls, ".*", {git, "https://github.com/processone/fast_tls", "f36ea5b74526c2c1c9c38f8d473168d95804f59d"}},

View File

@ -143,10 +143,14 @@ do_start(Level) ->
LogRotateSize = get_integer_env(log_rotate_size, 10*1024*1024),
LogRotateCount = get_integer_env(log_rotate_count, 1),
LogRateLimit = get_integer_env(log_rate_limit, 100),
ConsoleLevel = case get_lager_version() >= "3.6.0" of
true -> [{level, Level}];
false -> Level
end,
application:set_env(lager, error_logger_hwm, LogRateLimit),
application:set_env(
lager, handlers,
[{lager_console_backend, Level},
[{lager_console_backend, ConsoleLevel},
{lager_file_backend, [{file, ConsoleLog}, {level, Level}, {date, LogRotateDate},
{count, LogRotateCount}, {size, LogRotateSize}]},
{lager_file_backend, [{file, ErrorLog}, {level, error}, {date, LogRotateDate},
@ -252,3 +256,10 @@ get_lager_handlers() ->
Result ->
Result
end.
get_lager_version() ->
Apps = application:loaded_applications(),
case lists:keyfind(lager, 1, Apps) of
{_, _, Vsn} -> Vsn;
false -> "0.0.0"
end.