[Omaha.pm] Binary goo makes logs hard to read

Jay Hannah jhannah at omnihotels.com
Fri Dec 29 14:40:34 PST 2006


Solution:

      # If there's binary crap in here don't write that to my logs.
      # Instead, throw [ASCII:24] and the like to the logs.
      # -----
      my $logable = $payload;
      my $binary_char;
      while (($binary_char) = ($logable =~ /([^ -~])/)) {
         my $ord = "[ASCII:" . ord($binary_char) . "]";
         $logable =~ s/\Q$binary_char\E/$ord/gs;
      }
      $logger->error("I don't understand payload '$logable'");


j



More information about the Omaha-pm mailing list