anchor.diff:                          HookScriptFilename = filename:join([BinDir,
                                                               hook_filename(Hook)]),
                           %% write the hook script file to it's proper location
  -                        ok = render_hook(hook_template(Hook), HookScriptFilename),
  +                        ok = render_hook(hook_template(Hook), HookScriptFilename, State),
                           %% and return the invocation that's to be templated in the
                           %% extended script
                           Acc0 ++ [hook_invocation(Hook)];
                       false ->
  -                        rebar_api:info("~p hook is not allowed in the ~p phase, ignoring it",
  -                            [Hook, Phase]),
  +                        ec_cmd_log:error(
  +                            rlx_state:log(State),
  +                            io_lib:format("~p hook is not allowed in the ~p phase, ignoring it", [Hook, Phase])
  +                        ),
  +
                           Acc0
                   end
               end, [], Hooks0),
  -    expand_hooks(BinDir, Rest, Acc ++ [{Phase, Hooks}]).
  +    expand_hooks(BinDir, Rest, Acc ++ [{Phase, Hooks}], State).
   
   %% the pid script hook is only allowed in the
   %% post_start phase
  
positive.code:                         include_nodetool(BinDir),
                          Hooks = expand_hooks(BinDir,
                                               rlx_state:get(State,
                                                             extended_start_script_hooks, [])),
                          extended_bin_file_contents(OsFamily, RelName, RelVsn,
                                                     rlx_release:erts(Release), ErlOpts,
                                                     Hooks)
  
negative.code:             E
      end.
  
  expand_hooks(_Bindir, [], _State) -> [];
  expand_hooks(BinDir, Hooks, _State) ->
      expand_hooks(BinDir, Hooks, [], _State).
  
  expand_hooks(_BinDir, [], Acc, _State) -> Acc;
  expand_hooks(BinDir, [{Phase, Hooks0} | Rest], Acc, State) ->
      %% filter and expand hooks to their respective shell scripts
      Hooks =
          lists:foldl(
  