Przeglądaj źródła

Merge pull request #1920 from ferd/fallback-log

Fallback when logging isn't initialized
pull/1921/head
Fred Hebert 6 lat temu
committed by GitHub
rodzic
commit
ac69c38986
Nie znaleziono w bazie danych klucza dla tego podpisu ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 11 dodań i 4 usunięć
  1. +11
    -4
      src/rebar_log.erl

+ 11
- 4
src/rebar_log.erl Wyświetl plik

@ -93,11 +93,18 @@ get_level() ->
end.
log(Level = error, Str, Args) ->
{ok, LogState} = application:get_env(rebar, log),
ec_cmd_log:Level(LogState, lists:flatten(cf:format("~!^~ts~n", [Str])), Args);
case application:get_env(rebar, log) of
{ok, LogState} ->
NewStr = lists:flatten(cf:format("~!^~ts~n", [Str])),
ec_cmd_log:Level( LogState, NewStr, Args);
undefined -> % fallback
io:format(standard_error, Str++"~n", Args)
end;
log(Level, Str, Args) ->
{ok, LogState} = application:get_env(rebar, log),
ec_cmd_log:Level(LogState, Str++"~n", Args).
case application:get_env(rebar, log) of
{ok, LogState} -> ec_cmd_log:Level(LogState, Str++"~n", Args);
undefined -> io:format(Str++"~n", Args)
end.
crashdump(Str, Args) ->
crashdump("rebar3.crashdump", Str, Args).

Ładowanie…
Anuluj
Zapisz