ソースを参照

Add application stops

adt/lager_use_logger-option
Andrew Thompson 6年前
コミット
0e07296df7
1個のファイルの変更12行の追加0行の削除
  1. +12
    -0
      src/lager_logger_formatter.erl

+ 12
- 0
src/lager_logger_formatter.erl ファイルの表示

@ -79,6 +79,18 @@ format(#{level := Level, msg := {report, #{label := {application_controller, pro
Msg = lager_format:format("Application ~w started on node ~w", [Name, Node], maps:get(max_size, Config, 1024)), Msg = lager_format:format("Application ~w started on node ~w", [Name, Node], maps:get(max_size, Config, 1024)),
do_format(Level, Msg, Metadata, Config) do_format(Level, Msg, Metadata, Config)
end; end;
format(#{level := Level, msg := {report, #{label := {application_controller, exit}, report := Report}}, meta := Metadata}, Config) ->
{exited, Reason} = lists:keyfind(exited, 1, Report),
case application:get_env(lager, suppress_application_start_stop) of
{ok, true} when Reason == stopped ->
ok;
_ ->
{application, Name} = lists:keyfind(application, 1, Report),
{_Md, Formatted} = format_reason_md(Reason),
Msg = lager_format:format("Application ~w exited with reason: ~s", [Name, Formatted], maps:get(max_size, Config, 1024)),
do_format(Level, Msg, Metadata, Config)
end;
%% TODO handle proc_lib crash
format(#{level := _Level, msg := {report, Report}, meta := _Metadata}, _Config) -> format(#{level := _Level, msg := {report, Report}, meta := _Metadata}, _Config) ->
%do_format(Level, (maps:get(report_cb, Metadata))(Report), Metadata, Config); %do_format(Level, (maps:get(report_cb, Metadata))(Report), Metadata, Config);
io_lib:format("REPORT ~p~n", [Report]); io_lib:format("REPORT ~p~n", [Report]);

読み込み中…
キャンセル
保存