summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatarWilliam Heimbigner <william.heimbigner@gmail.com>2012-05-09 16:03:49 +0000
committerLibravatarWilliam Heimbigner <william.heimbigner@gmail.com>2012-05-09 16:03:49 +0000
commit0a015759fe56248a6f18e65b2667d48b40ec10e5 (patch)
tree430dd29baaeec9e8e8a80410322d8bc500f6ec80
parent1797c15c9842b1b91893c5b7289ce4542ff2b823 (diff)
Don't die when unable to print to a log file
-rw-r--r--modules/log.pl9
1 files changed, 6 insertions, 3 deletions
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";