diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/rebar_log.erl | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/rebar_log.erl b/src/rebar_log.erl index 06cfa9c..d921110 100644 --- a/src/rebar_log.erl +++ b/src/rebar_log.erl @@ -37,6 +37,7 @@ -define(WARN_LEVEL, 1). -define(INFO_LEVEL, 2). -define(DEBUG_LEVEL, 3). +-define(DFLT_INTENSITY, low). %% =================================================================== %% Public API @@ -49,12 +50,23 @@ init(Caller, Verbosity) -> ?INFO_LEVEL -> info; ?DEBUG_LEVEL -> debug end, - Log = ec_cmd_log:new(Level, Caller), + Intensity = case os:getenv("REBAR_COLOR") of + "high" -> + high; + "low" -> + low; + _ -> + ?DFLT_INTENSITY + end, + Log = ec_cmd_log:new(Level, Caller, Intensity), application:set_env(rebar, log, Log). set_level(Level) -> ok = application:set_env(rebar, log_level, Level). +log(Level = error, Str, Args) -> + {ok, LogState} = application:get_env(rebar, log), + ec_cmd_log:Level(LogState, lists:flatten(cf:format("~!^~s~n", [Str])), Args); log(Level, Str, Args) -> {ok, LogState} = application:get_env(rebar, log), ec_cmd_log:Level(LogState, Str++"~n", Args). |