diff options
author | Brian Cully <bjc@kublai.com> | 2017-11-16 16:57:15 +0000 |
---|---|---|
committer | Brian Cully <bjc@kublai.com> | 2017-11-16 16:57:15 +0000 |
commit | 1a548e6be0318339711dd4e7b539e3a26647265c (patch) | |
tree | 719b1c9b0a5bc4c6128a6948c6043abf8fac7932 /xmpt | |
parent | 7ad6420a0344a66328855777d99dd5d78898b3c7 (diff) | |
download | xmpt-1a548e6be0318339711dd4e7b539e3a26647265c.tar.gz xmpt-1a548e6be0318339711dd4e7b539e3a26647265c.zip |
Use named logging routines.
* error/warning/verbose
* All logs dump timestamps and PID.
Diffstat (limited to 'xmpt')
-rwxr-xr-x | xmpt | 22 |
1 files changed, 16 insertions, 6 deletions
@@ -186,7 +186,7 @@ sub do_send { # TODO: make write SIGPIPE configurable, but for now just ignore it. local $SIG{PIPE} = sub { - print STDERR "Warning: SIGPIPE received from '@ARGV' while writing in $name step.\n" + warning("SIGPIPE received from '@ARGV' while writing in $name step.\n"); }; print $evalpkg::out $s; } @@ -246,12 +246,22 @@ sub do_recv { } } +sub error { + _l("ERROR: " . shift); +} + +sub warning { + _l("Warning: " . shift); +} + sub verbose { - if ($verbose) { - my $msg = shift; - chomp $msg; - print STDERR strftime('%Y-%m-%d %H:%M:%S', localtime) . " [$$] $msg\n"; - } + _l(shift) if $verbose; +} + +sub _l { + my $msg = shift; + chomp $msg; + print STDERR strftime('%Y-%m-%d %H:%M:%S', localtime) . " [$$] $msg\n"; } sub assert_arg { |