3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-12-24 11:42:35 +01:00

Correct error handling for log_factoid() failure to open file

This commit is contained in:
Pragmatic Software 2015-12-14 14:30:44 -08:00
parent 20a8c30d4c
commit 167d8c2143

View File

@ -107,12 +107,10 @@ sub log_factoid {
$channel = 'global' if $channel eq '.*';
my $path = $self->{pbot}->{registry}->get_value('general', 'data_dir') . '/factlog';
open my $fh, ">> $path/$trigger.$channel";
if (not $fh) {
open my $fh, ">> $path/$trigger.$channel" or do {
$self->{pbot}->{logger}->log("Failed to open factlog for $channel/$trigger: $!\n");
return;
}
};
my $now = gettimeofday;
print $fh "$now $hostmask $msg\n";