summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeinz N. Gies <heinz@licenser.net>2016-02-16 12:08:09 -0500
committerHeinz N. Gies <heinz@licenser.net>2016-02-16 12:08:09 -0500
commitc79fe4cf1b123e049f9582c6f829074fe4e45d72 (patch)
treeaf0e5563ae1695bb393ae1253f23d6bbb3b89ae7
parent949eafd8991292b1726e735d356864f079e8313a (diff)
Use an app_env to get color intensity
-rw-r--r--src/rebar_log.erl24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/rebar_log.erl b/src/rebar_log.erl
index eb37869..9eb3da6 100644
--- a/src/rebar_log.erl
+++ b/src/rebar_log.erl
@@ -30,6 +30,7 @@
set_level/1,
error_level/0,
default_level/0,
+ intensity/0,
log/3,
is_verbose/1]).
@@ -43,14 +44,23 @@
%% Public API
%% ===================================================================
+%% @doc Returns the color intensity, we first check the application envorinment
+%% if that is not set we check the environment variable REBAR_COLOR.
intensity() ->
- case os:getenv("REBAR_COLOR") of
- "high" ->
- high;
- "low" ->
- low;
- _ ->
- ?DFLT_INTENSITY
+ case application:get_env(rebar, color_intensity) of
+ undefined ->
+ R = case os:getenv("REBAR_COLOR") of
+ "high" ->
+ high;
+ "low" ->
+ low;
+ _ ->
+ ?DFLT_INTENSITY
+ end,
+ application:set_env(rebar, color_intensity, R),
+ R;
+ {ok, Mode} ->
+ Mode
end.
init(Caller, Verbosity) ->