mirror of
https://github.com/pragma-/pbot.git
synced 2024-12-25 12:12:34 +01:00
Correct error handling for log_factoid() failure to open file
This commit is contained in:
parent
20a8c30d4c
commit
167d8c2143
@ -107,12 +107,10 @@ sub log_factoid {
|
|||||||
$channel = 'global' if $channel eq '.*';
|
$channel = 'global' if $channel eq '.*';
|
||||||
|
|
||||||
my $path = $self->{pbot}->{registry}->get_value('general', 'data_dir') . '/factlog';
|
my $path = $self->{pbot}->{registry}->get_value('general', 'data_dir') . '/factlog';
|
||||||
open my $fh, ">> $path/$trigger.$channel";
|
open my $fh, ">> $path/$trigger.$channel" or do {
|
||||||
|
|
||||||
if (not $fh) {
|
|
||||||
$self->{pbot}->{logger}->log("Failed to open factlog for $channel/$trigger: $!\n");
|
$self->{pbot}->{logger}->log("Failed to open factlog for $channel/$trigger: $!\n");
|
||||||
return;
|
return;
|
||||||
}
|
};
|
||||||
|
|
||||||
my $now = gettimeofday;
|
my $now = gettimeofday;
|
||||||
print $fh "$now $hostmask $msg\n";
|
print $fh "$now $hostmask $msg\n";
|
||||||
|
Loading…
Reference in New Issue
Block a user