Skip to content

Commit

Permalink
Add iadvize context
Browse files Browse the repository at this point in the history
Signed-off-by: Freyskeyd <[email protected]>
  • Loading branch information
Freyskeyd authored and xela85 committed Aug 19, 2024
1 parent bb28265 commit 07304f9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/ejabberd_options.erl
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ opt_type(auth_scram_hash) ->
econf:enum([sha, sha256, sha512]);
opt_type(auth_use_cache) ->
econf:bool();
opt_type(auth_profile_opts) ->
econf:any();
opt_type(c2s_cafile) ->
econf:file();
opt_type(c2s_ciphers) ->
Expand Down Expand Up @@ -513,6 +515,7 @@ options() ->
{queue_type, ram},
{version, ejabberd_config:version()},
%% Other options
{auth_profile_opts, []},
{acl, []},
{access_rules, []},
{acme, #{}},
Expand Down
18 changes: 16 additions & 2 deletions src/elixir_logger_backend.erl
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,21 @@ init(Opts) ->

%% @private
handle_event({log, LagerMsg}, State) ->
#{mode := Mode, truncate := Truncate, level := MinLevel, utc_log := UTCLog} = 'Elixir.Logger.Config':'__data__'(),
Truncate = case 'Elixir.Application':fetch_env(logger, truncate) of
{ok, ElixirTruncate} -> ElixirTruncate;
_ -> 8192
end,

UTCLog = case 'Elixir.Application':fetch_env(logger, utc_log) of
{ok, ElixirUTCLog} -> ElixirUTCLog;
_ -> false
end,

MinLevel = case 'Elixir.Application':fetch_env(logger, level) of
{ok, ElixirLevel} -> ElixirLevel;
_ -> false
end,

MsgLevel = severity_to_level(lager_msg:severity(LagerMsg)),
case {lager_util:is_loggable(LagerMsg, lager_util:level_to_num(State#state.level), ?MODULE),
'Elixir.Logger':compare_levels(MsgLevel, MinLevel)} of
Expand All @@ -56,7 +70,7 @@ handle_event({log, LagerMsg}, State) ->
erlang:process_info(self(), group_leader);
_ -> {group_leader, self()}
end,
notify(Mode, {MsgLevel, GroupLeader, {'Elixir.Logger', Message, Timestamp, Metadata}}),
notify(async, {MsgLevel, GroupLeader, {'Elixir.Logger', Message, Timestamp, Metadata}}),
{ok, State};
_ ->
{ok, State}
Expand Down

0 comments on commit 07304f9

Please sign in to comment.