1

Fix logging, update sample config, implement !horse !лошадка !frog !лягушка !snail !улитка commands

* Make logging use features of Log::Any and log as it should be done via this module
+ Add loglevel parameter to sample config
+ Implement !horse !лошадка !frog !лягушка !snail !улитка commands
This commit is contained in:
eleksir
2021-05-07 12:49:40 +03:00
parent 2cfede2769
commit e821356a64
17 changed files with 159 additions and 85 deletions

View File

@@ -11,6 +11,7 @@ use CHI;
use CHI::Driver::BerkeleyDB;
use HTTP::Tiny;
use JSON::XS;
use Log::Any qw ($log);
use BotLib::Conf qw (LoadConf);
use BotLib::Util qw (trim urlencode);
@@ -33,7 +34,7 @@ sub Weather {
my $appid = $c->{openweathermap}->{appid};
unless (defined $appid) {
carp 'No appid specified for openweathermap';
$log->warn ('[WARN] No appid specified for openweathermap');
return undef;
}
@@ -60,11 +61,11 @@ sub Weather {
};
unless (defined $fc) {
carp "[WARN] openweathermap returns corrupted json: $EVAL_ERROR";
$log->warn ("[WARN] openweathermap returns corrupted json: $EVAL_ERROR");
return undef;
};
} else {
carp sprintf 'Server return status %s with message: %s', $r->{status}, $r->{reason};
$log->warn (sprintf 'Server return status %s with message: %s', $r->{status}, $r->{reason});
return undef;
}