anchor.diff:      end.
   
   
  -access_sql(Access) ->
  +sql(Access) ->
       case maps:get(args, Access, "") of
           #{<<"qstr">> := QStr} ->
               re:replace(
  
positive.code: -module(dderl_access_logger).
  -include("dderl.hrl").
  
  -export([install/1, uninstall/1, log/2]).
  
  -define(AccessSchema,
          [{src,       fun access_src/1},
           {proxy,     fun access_proxy/1},
           {userId,    fun access_userid/1},
           {userName,  fun access_username/1},
           {sessId,    fun access_sessionid/1},
           {version,   fun access_version/1},
           loglevel,
           cmd,
           {args,      fun access_args/1},
           {bytes,     fun access_bytes/1},
           {time,      fun access_time/1},
           connUser,
           connTarget,
           connDbType,
           connStr,
           {sql,       fun access_sql/1}]).
  
  
  install(App) ->
      ok = gen_event:add_handler(
             lager_event, {dderl_access_lager_file_backend, App},
             [{file, "log/dderl_access.log"}, {level, debug}, {size, 10485760},
              {date, "$D0"}, {count, 5}, {application, App}, {props, ?AccessSchema}]),
      ok = lager:set_loglevel({dderl_access_lager_file_backend, App}, debug),
      ?Info("activity logger started").
  
  
negative.code:     ok = gen_event:delete_handler(
             lager_event, {dderl_access_lager_file_backend, App}, []).
  
  src(Access) ->
      case maps:get(src, Access, "") of
          SrcIp when is_tuple(SrcIp) -> inet:ntoa(SrcIp);
          SrcIp when is_list(SrcIp) -> SrcIp;
          SrcIp -> io_lib:format("~p", [SrcIp])
      end.
  
  proxy(Access) ->
      SrcIp = maps:get(src, Access, ""),
      case maps:get(proxy, Access, "") of
          SrcIp -> "yes";
          _ -> "no"
      end.
  
  userid(Access) ->
      case maps:get(userId, Access, "") of
          undefined -> "";
          User when is_list(User) -> User;
          User -> io_lib:format("~p", [User])
      end.
  
  username(Access) ->
      case maps:get(userName, Access, "") of
          User when is_list(User) -> User;
          User when is_binary(User) -> binary_to_list(User);
          User -> io_lib:format("~p", [User])
      end.
  
  sessionid(Access) ->
      base64:encode_to_string(
        integer_to_list(
          erlang:phash2(
            maps:get(sessId, Access, "")))).
  
  version(Access) ->
      case application:get_key(maps:get(app,Access,undefined)) of
          {ok, Vsn} -> Vsn;
          _ -> ""
      end.
  
  args(Access) ->
      CmdArgs = maps:get(args, Access, ""),
      binary_to_list(
        case CmdArgs of
  