From 0a015759fe56248a6f18e65b2667d48b40ec10e5 Mon Sep 17 00:00:00 2001 From: William Heimbigner Date: Wed, 9 May 2012 16:03:49 +0000 Subject: Don't die when unable to print to a log file --- modules/log.pl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'modules') diff --git a/modules/log.pl b/modules/log.pl index 581f70b..8b30eab 100644 --- a/modules/log.pl +++ b/modules/log.pl @@ -46,9 +46,12 @@ sub logg my $nostamp = $_; $_ = strftime($cfg->{timefmt}, @time) . $_ . "\n"; my $line = $_; - open(FH, $path) or die "Can't open $path: $!"; - print FH $line; - close(FH); + if (open(FH, $path)) { # or die "Can't open $path: $!"; + print FH $line; + close(FH); + } else { + print "COULDN'T PRINT TO $path - $line"; + } if (defined($::spy{$chan})) { my $spy = $::spy{$chan}; print $spy $chan .": " . $nostamp . "\n"; -- cgit v1.2.3