aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/relx.erl32
-rw-r--r--src/rlx_app_discovery.erl40
-rw-r--r--src/rlx_cmd_args.erl2
-rw-r--r--src/rlx_log.erl251
-rw-r--r--src/rlx_prv_assembler.erl12
-rw-r--r--src/rlx_prv_overlay.erl8
-rw-r--r--src/rlx_prv_release.erl6
-rw-r--r--src/rlx_rel_discovery.erl4
-rw-r--r--src/rlx_state.erl10
9 files changed, 57 insertions, 308 deletions
diff --git a/src/relx.erl b/src/relx.erl
index 7b09751..1ac91d9 100644
--- a/src/relx.erl
+++ b/src/relx.erl
@@ -81,7 +81,7 @@ main(Args) ->
%% @param LibDirs - The library dirs that should be used for the system
%% @param OutputDir - The directory where the release should be built to
%% @param Configs - The list of config files for the system
--spec do(atom(), string(), [goal()], [file:name()], rlx_log:log_level(),
+-spec do(atom(), string(), [goal()], [file:name()], ec_cmd_log:log_level(),
[file:name()], file:name() | undefined) ->
ok | error() | {ok, rlx_state:t()}.
do(RelName, RelVsn, Goals, LibDirs, LogLevel, OutputDir, Config) ->
@@ -99,8 +99,8 @@ do(RelName, RelVsn, Goals, LibDirs, LogLevel, OutputDir, Config) ->
%% @param OutputDir - The directory where the release should be built to
%% @param Configs - The list of config files for the system
-spec do(file:name(), atom(), string(), [goal()], [file:name()],
- rlx_log:log_level(), [file:name()], file:name() | undefined) ->
- ok | error() | {ok, rlx_state:t()}.
+ ec_cmd_log:log_level(), [file:name()], file:name() | undefined) ->
+ ok | error() | {ok, rlx_state:t()}.
do(RootDir, RelName, RelVsn, Goals, LibDirs, LogLevel, OutputDir, Configs) ->
do(RootDir, RelName, RelVsn, Goals, LibDirs, LogLevel, OutputDir, [], Configs).
@@ -116,8 +116,8 @@ do(RootDir, RelName, RelVsn, Goals, LibDirs, LogLevel, OutputDir, Configs) ->
%% @param Overrides - A list of overrides for the system
%% @param Configs - The list of config files for the system
-spec do(file:name(), atom(), string(), [goal()], [file:name()],
- rlx_log:log_level(), [file:name()], [{atom(), file:name()}], file:name() | undefined) ->
- ok | error() | {ok, rlx_state:t()}.
+ ec_cmd_log:log_level(), [file:name()], [{atom(), file:name()}], file:name() | undefined) ->
+ ok | error() | {ok, rlx_state:t()}.
do(RootDir, RelName, RelVsn, Goals, LibDirs, LogLevel, OutputDir, Overrides, Config) ->
do([{relname, RelName},
{relvsn, RelVsn},
@@ -221,11 +221,11 @@ format_error({error, {Module, Reason}}) ->
%% internal api
%%============================================================================
run_relx_process(State) ->
- rlx_log:info(rlx_state:log(State), "Starting relx build process ..."),
- rlx_log:debug(rlx_state:log(State),
- fun() ->
- rlx_state:format(State)
- end),
+ ec_cmd_log:info(rlx_state:log(State), "Starting relx build process ..."),
+ ec_cmd_log:debug(rlx_state:log(State),
+ fun() ->
+ rlx_state:format(State)
+ end),
run_providers(State).
%% @doc for now the 'config' provider is special in that it generates the
@@ -269,16 +269,16 @@ run_providers(ConfigProvider, Providers, State0) ->
run_provider(_Provider, Error = {error, _}) ->
Error;
run_provider(Provider, {ok, State0}) ->
- rlx_log:debug(rlx_state:log(State0), "Running provider ~p~n",
- [rlx_provider:impl(Provider)]),
+ ec_cmd_log:debug(rlx_state:log(State0), "Running provider ~p~n",
+ [rlx_provider:impl(Provider)]),
case rlx_provider:do(Provider, State0) of
{ok, State1} ->
- rlx_log:debug(rlx_state:log(State0), "Provider successfully run: ~p~n",
- [rlx_provider:impl(Provider)]),
+ ec_cmd_log:debug(rlx_state:log(State0), "Provider successfully run: ~p~n",
+ [rlx_provider:impl(Provider)]),
{ok, State1};
E={error, _} ->
- rlx_log:debug(rlx_state:log(State0), "Provider (~p) failed with: ~p~n",
- [rlx_provider:impl(Provider), E]),
+ ec_cmd_log:debug(rlx_state:log(State0), "Provider (~p) failed with: ~p~n",
+ [rlx_provider:impl(Provider), E]),
E
end.
diff --git a/src/rlx_app_discovery.erl b/src/rlx_app_discovery.erl
index 515e6ae..aaa6e86 100644
--- a/src/rlx_app_discovery.erl
+++ b/src/rlx_app_discovery.erl
@@ -37,11 +37,11 @@
%% looking for OTP Applications
-spec do(rlx_state:t(), [file:name()]) -> {ok, [rlx_app_info:t()]} | relx:error().
do(State, LibDirs) ->
- rlx_log:info(rlx_state:log(State),
- fun() ->
- ["Resolving OTP Applications from directories:\n",
- string:join([[rlx_util:indent(2), LibDir] || LibDir <- LibDirs], "\n")]
- end),
+ ec_cmd_log:info(rlx_state:log(State),
+ fun() ->
+ ["Resolving OTP Applications from directories:\n",
+ string:join([[rlx_util:indent(2), LibDir] || LibDir <- LibDirs], "\n")]
+ end),
resolve_app_metadata(State, LibDirs).
-spec format_error([ErrorDetail::term()]) -> iolist().
@@ -58,25 +58,25 @@ resolve_app_metadata(State, LibDirs) ->
{error, Ret} ->
Ret
end
- || Err <- AppMeta0,
- case Err of
- {error, _} ->
- true;
- {warning, W} ->
- rlx_log:warn(rlx_state:log(State), format_detail(W)),
- false;
- _ ->
- false
- end] of
+ || Err <- AppMeta0,
+ case Err of
+ {error, _} ->
+ true;
+ {warning, W} ->
+ ec_cmd_log:warn(rlx_state:log(State), format_detail(W)),
+ false;
+ _ ->
+ false
+ end] of
[] ->
SkipApps = rlx_state:skip_apps(State),
AppMeta1 = [App || {ok, App} <- setup_overrides(State, AppMeta0),
not lists:keymember(rlx_app_info:name(App), 1, SkipApps)],
- rlx_log:debug(rlx_state:log(State),
- fun() ->
- ["Resolved the following OTP Applications from the system: \n",
- [[rlx_app_info:format(2, App), "\n"] || App <- AppMeta1]]
- end),
+ ec_cmd_log:debug(rlx_state:log(State),
+ fun() ->
+ ["Resolved the following OTP Applications from the system: \n",
+ [[rlx_app_info:format(2, App), "\n"] || App <- AppMeta1]]
+ end),
{ok, AppMeta1};
Errors ->
?RLX_ERROR(Errors)
diff --git a/src/rlx_cmd_args.erl b/src/rlx_cmd_args.erl
index e360ab8..ea32fd4 100644
--- a/src/rlx_cmd_args.erl
+++ b/src/rlx_cmd_args.erl
@@ -137,7 +137,7 @@ create_log(Opts, Acc) ->
LogLevel = proplists:get_value(log_level, Opts, 0),
if
LogLevel >= 0, LogLevel =< 3 ->
- create_goals(Opts, [{log, rlx_log:new(LogLevel, command_line)} | Acc]);
+ create_goals(Opts, [{log, ec_cmd_log:new(LogLevel, command_line)} | Acc]);
true ->
?RLX_ERROR({invalid_log_level, LogLevel})
end.
diff --git a/src/rlx_log.erl b/src/rlx_log.erl
deleted file mode 100644
index c616c1b..0000000
--- a/src/rlx_log.erl
+++ /dev/null
@@ -1,251 +0,0 @@
-%% -*- erlang-indent-level: 4; indent-tabs-mode: nil; fill-column: 80 -*-
-%%% Copyright 2012 Erlware, LLC. All Rights Reserved.
-%%%
-%%% This file is provided to you under the Apache License,
-%%% Version 2.0 (the "License"); you may not use this file
-%%% except in compliance with the License. You may obtain
-%%% a copy of the License at
-%%%
-%%% http://www.apache.org/licenses/LICENSE-2.0
-%%%
-%%% Unless required by applicable law or agreed to in writing,
-%%% software distributed under the License is distributed on an
-%%% "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-%%% KIND, either express or implied. See the License for the
-%%% specific language governing permissions and limitations
-%%% under the License.
-%%%---------------------------------------------------------------------------
-%%% @author Eric Merritt <[email protected]>
-%%% @copyright (C) 2012 Erlware, LLC.
-%%%
-%%% @doc This provides simple output functions for relx. You should use this
-%%% to talk to the users if you are wrting code for the system
--module(rlx_log).
-
--export([new/1,
- new/2,
- log/4,
- should/2,
- debug/2,
- debug/3,
- info/2,
- info/3,
- error/2,
- error/3,
- warn/2,
- warn/3,
- log_level/1,
- atom_log_level/1,
- format/1]).
-
--export_type([t/0,
- int_log_level/0,
- atom_log_level/0,
- log_level/0,
- log_fun/0]).
-
--include("relx.hrl").
-
--define(RED, 31).
--define(GREEN, 32).
--define(YELLOW, 33).
--define(BLUE, 34).
--define(MAGENTA, 35).
--define(CYAN, 36).
-
--define(PREFIX, "===> ").
-
--record(state_t, {mod=?MODULE :: rlx_log,
- log_level=0 :: int_log_level(),
- caller=api :: api | command_line}).
-
-%%============================================================================
-%% types
-%%============================================================================
-
--type log_level() :: int_log_level() | atom_log_level().
-
--type int_log_level() :: 0..3.
-
--type atom_log_level() :: error | warn | info | debug.
-
--type log_fun() :: fun(() -> iolist()).
-
--type color() :: 31..36.
-
--opaque t() :: record(state_t).
-
-%%============================================================================
-%% API
-%%============================================================================
-%% @doc Create a new 'log level' for the system
--spec new(log_level()) -> t().
-new(LogLevel) ->
- new(LogLevel, api).
-
-new(LogLevel, Caller) when LogLevel >= 0, LogLevel =< 3 ->
- #state_t{mod=?MODULE, log_level=LogLevel, caller=Caller};
-new(AtomLogLevel, Caller)
- when AtomLogLevel =:= error;
- AtomLogLevel =:= warn;
- AtomLogLevel =:= info;
- AtomLogLevel =:= debug ->
- LogLevel = case AtomLogLevel of
- error -> 0;
- warn -> 1;
- info -> 2;
- debug -> 3
- end,
- new(LogLevel, Caller).
-
-
-%% @doc log at the debug level given the current log state with a string or
-%% function that returns a string
--spec debug(t(), string() | log_fun()) -> ok.
-debug(LogState, Fun)
- when erlang:is_function(Fun) ->
- log(LogState, ?RLX_DEBUG, fun() -> colorize(LogState, ?CYAN, false, Fun()) end);
-debug(LogState, String) ->
- debug(LogState, "~s~n", [String]).
-
-%% @doc log at the debug level given the current log state with a format string
-%% and argements @see io:format/2
--spec debug(t(), string(), [any()]) -> ok.
-debug(LogState, FormatString, Args) ->
- log(LogState, ?RLX_DEBUG, colorize(LogState, ?CYAN, false, FormatString), Args).
-
-%% @doc log at the info level given the current log state with a string or
-%% function that returns a string
--spec info(t(), string() | log_fun()) -> ok.
-info(LogState, Fun)
- when erlang:is_function(Fun) ->
- log(LogState, ?RLX_INFO, fun() -> colorize(LogState, ?GREEN, false, Fun()) end);
-info(LogState, String) ->
- info(LogState, "~s~n", [String]).
-
-%% @doc log at the info level given the current log state with a format string
-%% and argements @see io:format/2
--spec info(t(), string(), [any()]) -> ok.
-info(LogState, FormatString, Args) ->
- log(LogState, ?RLX_INFO, colorize(LogState, ?GREEN, false, FormatString), Args).
-
-%% @doc log at the error level given the current log state with a string or
-%% format string that returns a function
--spec error(t(), string() | log_fun()) -> ok.
-error(LogState, Fun)
- when erlang:is_function(Fun) ->
- log(LogState, ?RLX_ERROR, fun() -> colorize(LogState, ?RED, false, Fun()) end);
-error(LogState, String) ->
- error(LogState, "~s~n", [String]).
-
-%% @doc log at the error level given the current log state with a format string
-%% and argements @see io:format/2
--spec error(t(), string(), [any()]) -> ok.
-error(LogState, FormatString, Args) ->
- log(LogState, ?RLX_ERROR, colorize(LogState, ?GREEN, false, FormatString), Args).
-
-%% @doc log at the warn level given the current log state with a string or
-%% format string that returns a function
--spec warn(t(), string() | log_fun()) -> ok.
-warn(LogState, Fun)
- when erlang:is_function(Fun) ->
- log(LogState, ?RLX_WARN, fun() -> colorize(LogState, ?MAGENTA, false, Fun()) end);
-warn(LogState, String) ->
- warn(LogState, "~s~n", [String]).
-
-%% @doc log at the warn level given the current log state with a format string
-%% and argements @see io:format/2
--spec warn(t(), string(), [any()]) -> ok.
-warn(LogState, FormatString, Args) ->
- log(LogState, ?RLX_WARN, colorize(LogState, ?MAGENTA, false, FormatString), Args).
-
-%% @doc Execute the fun passed in if log level is as expected.
--spec log(t(), int_log_level(), log_fun()) -> ok.
-log(#state_t{mod=?MODULE, log_level=DetailLogLevel}, LogLevel, Fun)
- when DetailLogLevel >= LogLevel ->
- io:format("~s~n", [Fun()]);
-log(_, _, _) ->
- ok.
-
-%% @doc when the module log level is less then or equal to the log level for the
-%% call then write the log info out. When its not then ignore the call.
--spec log(t(), int_log_level(), string(), [any()]) -> ok.
-log(#state_t{mod=?MODULE, log_level=DetailLogLevel}, LogLevel, FormatString, Args)
- when DetailLogLevel >= LogLevel,
- erlang:is_list(Args) ->
- io:format(FormatString, Args);
-log(_, _, _, _) ->
- ok.
-
-%% @doc return a boolean indicating if the system should log for the specified
-%% levelg
--spec should(t(), int_log_level() | any()) -> boolean().
-should(#state_t{mod=?MODULE, log_level=DetailLogLevel}, LogLevel)
- when DetailLogLevel >= LogLevel ->
- true;
-should(_, _) ->
- false.
-
-%% @doc get the current log level as an integer
--spec log_level(t()) -> int_log_level().
-log_level(#state_t{mod=?MODULE, log_level=DetailLogLevel}) ->
- DetailLogLevel.
-
-%% @doc get the current log level as an atom
--spec atom_log_level(t()) -> atom_log_level().
-atom_log_level(#state_t{mod=?MODULE, log_level=?RLX_ERROR}) ->
- error;
-atom_log_level(#state_t{mod=?MODULE, log_level=?RLX_WARN}) ->
- warn;
-atom_log_level(#state_t{mod=?MODULE, log_level=?RLX_INFO}) ->
- info;
-atom_log_level(#state_t{mod=?MODULE, log_level=?RLX_DEBUG}) ->
- debug.
-
--spec format(t()) -> iolist().
-format(Log) ->
- [<<"(">>,
- erlang:integer_to_list(log_level(Log)), <<":">>,
- erlang:atom_to_list(atom_log_level(Log)),
- <<")">>].
-
--spec colorize(t(), color(), boolean(), string()) -> string().
-colorize(#state_t{caller=command_line}, Color, false, Msg) when is_integer(Color) ->
- colorize_(Color, 0, Msg);
-colorize(_LogState, _Color, _Bold, Msg) ->
- Msg.
-
--spec colorize_(color(), integer(), string()) -> string().
-colorize_(Color, Bold, Msg) when is_integer(Color), is_integer(Bold)->
- lists:flatten(io_lib:format("\033[~B;~Bm~s~s\033[0m", [Bold, Color, ?PREFIX, Msg])).
-
-%%%===================================================================
-%%% Test Functions
-%%%===================================================================
-
--ifndef(NOTEST).
--include_lib("eunit/include/eunit.hrl").
-
-should_test() ->
- ErrorLogState = new(error),
- ?assertMatch(true, should(ErrorLogState, ?RLX_ERROR)),
- ?assertMatch(true, not should(ErrorLogState, ?RLX_INFO)),
- ?assertMatch(true, not should(ErrorLogState, ?RLX_DEBUG)),
- ?assertEqual(?RLX_ERROR, log_level(ErrorLogState)),
- ?assertEqual(error, atom_log_level(ErrorLogState)),
-
- InfoLogState = new(info),
- ?assertMatch(true, should(InfoLogState, ?RLX_ERROR)),
- ?assertMatch(true, should(InfoLogState, ?RLX_INFO)),
- ?assertMatch(true, not should(InfoLogState, ?RLX_DEBUG)),
- ?assertEqual(?RLX_INFO, log_level(InfoLogState)),
- ?assertEqual(info, atom_log_level(InfoLogState)),
-
- DebugLogState = new(debug),
- ?assertMatch(true, should(DebugLogState, ?RLX_ERROR)),
- ?assertMatch(true, should(DebugLogState, ?RLX_INFO)),
- ?assertMatch(true, should(DebugLogState, ?RLX_DEBUG)),
- ?assertEqual(?RLX_DEBUG, log_level(DebugLogState)),
- ?assertEqual(debug, atom_log_level(DebugLogState)).
-
--endif.
diff --git a/src/rlx_prv_assembler.erl b/src/rlx_prv_assembler.erl
index b17b2cc..5389fde 100644
--- a/src/rlx_prv_assembler.erl
+++ b/src/rlx_prv_assembler.erl
@@ -380,14 +380,14 @@ make_boot_script(State, Release, OutputDir, RelDir) ->
systools:make_script(Name, CorrectedOptions)
end) of
ok ->
- rlx_log:error(rlx_state:log(State),
+ ec_cmd_log:error(rlx_state:log(State),
"release successfully created!"),
create_RELEASES(OutputDir, ReleaseFile),
{ok, State};
error ->
?RLX_ERROR({release_script_generation_error, ReleaseFile});
{ok, _, []} ->
- rlx_log:error(rlx_state:log(State),
+ ec_cmd_log:error(rlx_state:log(State),
"release successfully created!"),
create_RELEASES(OutputDir, ReleaseFile),
{ok, State};
@@ -481,7 +481,7 @@ update_tar(State, TempDir, OutputDir, Name, Vsn, ErtsVersion) ->
false ->
[]
end], [compressed]),
- rlx_log:info(rlx_state:log(State),
+ ec_cmd_log:info(rlx_state:log(State),
"tarball ~s successfully created!~n", [TarFile]),
ec_file:remove(TempDir, [recursive]),
{ok, State}.
@@ -503,7 +503,7 @@ make_upfrom_script(State, Release, UpFrom) ->
silent],
CurrentRel = strip_rel(rlx_release:relfile(Release)),
UpFromRel = strip_rel(rlx_release:relfile(UpFrom)),
- rlx_log:debug(rlx_state:log(State),
+ ec_cmd_log:debug(rlx_state:log(State),
"systools:make_relup(~p, ~p, ~p, ~p)",
[CurrentRel, UpFromRel, UpFromRel, Options]),
case make_script(Options,
@@ -511,14 +511,14 @@ make_upfrom_script(State, Release, UpFrom) ->
systools:make_relup(CurrentRel, [UpFromRel], [UpFromRel], CorrectOptions)
end) of
ok ->
- rlx_log:error(rlx_state:log(State),
+ ec_cmd_log:error(rlx_state:log(State),
"relup from ~s to ~s successfully created!",
[UpFromRel, CurrentRel]),
{ok, State};
error ->
?RLX_ERROR({relup_script_generation_error, CurrentRel, UpFromRel});
{ok, RelUp, _, []} ->
- rlx_log:error(rlx_state:log(State),
+ ec_cmd_log:error(rlx_state:log(State),
"relup successfully created!"),
write_relup_file(State, Release, RelUp),
{ok, State};
diff --git a/src/rlx_prv_overlay.erl b/src/rlx_prv_overlay.erl
index cd1fe33..a749ce5 100644
--- a/src/rlx_prv_overlay.erl
+++ b/src/rlx_prv_overlay.erl
@@ -132,14 +132,14 @@ merge_overlay_vars(State, FileNames) ->
{ok, Terms} ->
lists:ukeymerge(1, lists:ukeysort(1, Terms), Acc);
{error, Reason} ->
- rlx_log:warn(rlx_state:log(State),
- format_error({unable_to_read_varsfile, FileName, Reason})),
+ ec_cmd_log:warn(rlx_state:log(State),
+ format_error({unable_to_read_varsfile, FileName, Reason})),
Acc
end
end, [], FileNames).
-spec render_overlay_vars(proplists:proplist(), proplists:proplist(),
- proplists:proplist()) ->
+ proplists:proplist()) ->
{ok, proplists:proplist()} | relx:error().
render_overlay_vars(OverlayVars, [{Key, Value} | Rest], Acc)
when erlang:is_list(Value) ->
@@ -202,7 +202,7 @@ generate_app_vars(App) ->
-spec generate_state_vars(rlx_state:t()) -> proplists:proplist().
generate_state_vars(State) ->
- [{log, rlx_log:format(rlx_state:log(State))},
+ [{log, ec_cmd_log:format(rlx_state:log(State))},
{output_dir, rlx_state:output_dir(State)},
{target_dir, rlx_state:output_dir(State)},
{overridden, [AppName || {AppName, _} <- rlx_state:overrides(State)]},
diff --git a/src/rlx_prv_release.erl b/src/rlx_prv_release.erl
index 3e73136..134ff7a 100644
--- a/src/rlx_prv_release.erl
+++ b/src/rlx_prv_release.erl
@@ -138,7 +138,7 @@ release_sort({{RelNameA, RelVsnA}, _}, {{RelNameB, RelVsnB}, _}) ->
ec_semver:lte(RelVsnA, RelVsnB).
solve_release(State0, DepGraph, RelName, RelVsn) ->
- rlx_log:debug(rlx_state:log(State0),
+ ec_cmd_log:debug(rlx_state:log(State0),
"Solving Release ~p-~s~n",
[RelName, RelVsn]),
try
@@ -169,11 +169,11 @@ solve_release(State0, DepGraph, RelName, RelVsn) ->
set_resolved(State, Release0, Pkgs) ->
case rlx_release:realize(Release0, Pkgs, rlx_state:available_apps(State)) of
{ok, Release1} ->
- rlx_log:info(rlx_state:log(State),
+ ec_cmd_log:info(rlx_state:log(State),
"Resolved ~p-~s~n",
[rlx_release:name(Release1),
rlx_release:vsn(Release1)]),
- rlx_log:debug(rlx_state:log(State),
+ ec_cmd_log:debug(rlx_state:log(State),
fun() ->
rlx_release:format(0, Release1)
end),
diff --git a/src/rlx_rel_discovery.erl b/src/rlx_rel_discovery.erl
index 80a11eb..837ebe6 100644
--- a/src/rlx_rel_discovery.erl
+++ b/src/rlx_rel_discovery.erl
@@ -38,7 +38,7 @@
-spec do(rlx_state:t(), [file:name()], [rlx_app_info:t()]) ->
{ok, [rlx_release:t()]} | relx:error().
do(State, LibDirs, AppMeta) ->
- rlx_log:info(rlx_state:log(State),
+ ec_cmd_log:info(rlx_state:log(State),
fun() ->
["Resolving available OTP Releases from directories:\n",
string:join([[rlx_util:indent(2), LibDir] || LibDir <- LibDirs], "\n")]
@@ -75,7 +75,7 @@ resolve_rel_metadata(State, LibDirs, AppMeta) ->
case Errors of
[] ->
ReleaseMeta1 = [RelMeta || {ok, RelMeta} <- ReleaseMeta0],
- rlx_log:debug(rlx_state:log(State),
+ ec_cmd_log:debug(rlx_state:log(State),
fun() ->
["Resolved the following OTP Releases from the system: \n",
[[rlx_release:format(1, Rel), "\n"] || Rel <- ReleaseMeta1]]
diff --git a/src/rlx_state.erl b/src/rlx_state.erl
index 74304cc..1d235a9 100644
--- a/src/rlx_state.erl
+++ b/src/rlx_state.erl
@@ -71,7 +71,7 @@
cmd_args/0,
action/0]).
--record(state_t, {log :: rlx_log:t(),
+-record(state_t, {log :: ec_cmd_log:t(),
root_dir :: file:name(),
caller :: caller(),
actions=[] :: [action()],
@@ -118,7 +118,7 @@ new(PropList, Targets)
{ok, Root} = file:get_cwd(),
Caller = proplists:get_value(caller, PropList, api),
State0 =
- #state_t{log = proplists:get_value(log, PropList, rlx_log:new(error, Caller)),
+ #state_t{log = proplists:get_value(log, PropList, ec_cmd_log:new(error, Caller)),
output_dir=proplists:get_value(output_dir, PropList, ""),
lib_dirs=[to_binary(Dir) || Dir <- proplists:get_value(lib_dirs, PropList, [])],
config_file=proplists:get_value(config, PropList, undefined),
@@ -167,7 +167,7 @@ skip_apps(State, SkipApps) ->
State#state_t{skip_apps=SkipApps}.
%% @doc get the current log state for the system
--spec log(t()) -> rlx_log:t().
+-spec log(t()) -> ec_cmd_log:t().
log(#state_t{log=LogState}) ->
LogState.
@@ -330,7 +330,7 @@ format(#state_t{log=LogState, output_dir=OutDir, lib_dirs=LibDirs,
Values1 = ec_dictionary:to_list(Values0),
[rlx_util:indent(Indent),
<<"state(">>, erlang:atom_to_list(Caller), <<"):\n">>,
- rlx_util:indent(Indent + 2), <<"log: ">>, rlx_log:format(LogState), <<",\n">>,
+ rlx_util:indent(Indent + 2), <<"log: ">>, ec_cmd_log:format(LogState), <<",\n">>,
rlx_util:indent(Indent + 2), "config file: ", rlx_util:optional_to_string(ConfigFile), "\n",
rlx_util:indent(Indent + 2), "goals: \n",
[[rlx_util:indent(Indent + 3), rlx_depsolver:format_constraint(Goal), ",\n"] || Goal <- Goals],
@@ -371,7 +371,7 @@ to_binary(Dir)
-include_lib("eunit/include/eunit.hrl").
new_test() ->
- LogState = rlx_log:new(error),
+ LogState = ec_cmd_log:new(error),
RCLState = new([{log, LogState}], [release]),
?assertMatch(LogState, log(RCLState)).