anchor.diff:                         [ReportString, Stanza]),
                   ct:fail(Error)
           end,
  -    ct:pal(stanza_log, "~s~n~s", [ReportString, PrettyStanza]).
  +    PrintFun = case Target of
  +                   console_and_file -> pal;
  +                   console -> print;
  +                   file -> log
  +               end,
  +    %% grep anchor: ct:pal, ct:print, ct:log
  +    ct:PrintFun(stanza_log, "~s~n~s", [ReportString, PrettyStanza]).
   
   %% ------------- Common Test hack! -------------
   %% There is a bug in Common Test since 18.3, which causes links to be printed inside <pre/>.
  
positive.code: -spec log_stanza(undefined | binary(), in | out, exml_stream:element()) -> ok.
  log_stanza(undefined, _, _) -> ok;
  log_stanza(Jid, Direction, Stanza) ->
      case is_ct_available() andalso ct:get_config(stanza_log) of
          true ->
              do_log_stanza(Jid, Direction, Stanza);
          _ ->
              ok
      end.
  
negative.code: is_ct_available() ->
      code:is_loaded(ct) =/= false andalso ct:get_status() =/= no_tests_running.
  
  -spec do_log_stanza(Target, Jid, Direction, Stanza) -> ok when
        Target :: console_and_file | console | file,
        Jid :: binary(),
        Direction :: in | out,
        Stanza :: exml:element().
  do_log_stanza(Target, Jid, Direction, Stanza) ->
      ReportString = io_lib:format("~s ~p", [Jid, Direction]),
      PrettyStanza =
          try
  