aboutsummaryrefslogtreecommitdiffstats
path: root/xmpt
diff options
context:
space:
mode:
authorBrian Cully <bjc@kublai.com>2017-11-16 16:57:15 +0000
committerBrian Cully <bjc@kublai.com>2017-11-16 16:57:15 +0000
commit1a548e6be0318339711dd4e7b539e3a26647265c (patch)
tree719b1c9b0a5bc4c6128a6948c6043abf8fac7932 /xmpt
parent7ad6420a0344a66328855777d99dd5d78898b3c7 (diff)
downloadxmpt-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-xxmpt22
1 files changed, 16 insertions, 6 deletions
diff --git a/xmpt b/xmpt
index b422e2d..3d7cb3f 100755
--- a/xmpt
+++ b/xmpt
@@ -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 {