anchor.diff:                              Config;
                           Size0 ->
                               Size =
  -                                case Size0 - string:length([B,A]) of
  +                                case Size0 - io_lib:chars_length([B,A]) of
                                       S when S>=0 -> S;
                                       _ -> 0
                                   end,
  
positive.code:            true ->
                  ""
          end,
      truncate([B,MsgStr,A],maps:get(max_size,Config)).
  
  do_format(Level,Data,[level|Format],Config) ->
      [to_string(level,Level,Config)|do_format(Level,Data,Format,Config)];
  
negative.code:             throw(Error)
      end.
  
  truncate(B,Msg,A,unlimited) ->
      [B,Msg,A];
  truncate(B,Msg,A,Size) ->
      String = [B,Msg,A],
      Length = io_lib:chars_length(String),
      if Length>Size ->
              {Last,FlatString} =
                  case A of
                      [] ->
                          case Msg of
                              [] ->
                                  {get_last(B),lists:flatten(B)};
                              _ ->
                                  {get_last(Msg),lists:flatten([B,Msg])}
                          end;
                      _ ->
                          {get_last(A),lists:flatten(String)}
                  end,
              case Last of
                  $\n->
                      lists:sublist(FlatString,1,Size-4)++"...\n";
                  _ ->
                      lists:sublist(FlatString,1,Size-3)++"..."
              end;
         true ->
              String
      end.
  
  get_last(L) ->
      get_first(lists:reverse(L)).
  
  get_first([]) ->
      error;
  get_first([C|_]) when is_integer(C) ->
      C;
  get_first([L|Rest]) when is_list(L) ->
      case get_last(L) of
          error -> get_first(Rest);
          First -> First
      end.
  
  %% SysTime is the system time in microseconds
  