3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-30 07:49:38 +01:00

Improve Logger text escaping

This commit is contained in:
Pragmatic Software 2017-09-05 00:18:35 -07:00
parent c3938ed8bb
commit 5262934e0d

View File

@ -36,7 +36,7 @@ sub log {
my ($self, $text) = @_;
my $time = localtime;
$text =~ s/([\01-\010]|[\016-\037])/'\\' . ord $1/ge;
$text =~ s/(\P{PosixGraph})/my $ch = $1; if ($ch =~ m{[\s]}) { $ch } else { sprintf "\\x%02X", ord $ch }/ge;
if(defined $self->{log_file}) {
print PLOG_FILE "$time :: $text";