diff options
author | simonxu72 <simon.xu72@gmail.com> | 2018-11-13 13:19:13 +0800 |
---|---|---|
committer | simonxu72 <simon.xu72@gmail.com> | 2018-11-13 13:19:13 +0800 |
commit | 4014faf695c3da3a8f0c7aa088cdae0725433d16 (patch) | |
tree | 9601583c4314fd1fdca3c12d657ac54b286f9d21 /src/rebar_log.erl | |
parent | 41d133856bf199034b0eeb0903bedc2071fba7e1 (diff) | |
parent | d0e9a553468424b53aeb9907201d0b4f5aa4fad2 (diff) |
merge from upstream/master
Diffstat (limited to 'src/rebar_log.erl')
-rw-r--r-- | src/rebar_log.erl | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/rebar_log.erl b/src/rebar_log.erl index 9150346..7fc2312 100644 --- a/src/rebar_log.erl +++ b/src/rebar_log.erl @@ -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). |