aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Spek <p.spek@tyil.nl>2020-07-02 16:00:17 +0200
committerPatrick Spek <p.spek@tyil.nl>2020-07-02 16:00:17 +0200
commit3d9294c96a7fd3d5e0a8c1099985e6d449d758cf (patch)
treed0c4f805e8adc0a40fe48c50c1a4acd5d082f3c9
parente008136fa93b1e3091f5940ba095a1552734face (diff)
downloadmusashi-3d9294c96a7fd3d5e0a8c1099985e6d449d758cf.tar.gz
musashi-3d9294c96a7fd3d5e0a8c1099985e6d449d758cf.tar.bz2
Update Log calls
-rw-r--r--META6.json2
-rw-r--r--lib/Local/Musashi.pm620
2 files changed, 10 insertions, 12 deletions
diff --git a/META6.json b/META6.json
index c3fbf09..0a2aaf8 100644
--- a/META6.json
+++ b/META6.json
@@ -10,7 +10,7 @@
"IRC::Client",
"IRC::Client::Plugin::NickServ:ver<0.3.0+>:api<0>",
"IRC::Client::Plugin::DiceRolls:ver<0.2.1>",
- "Log:auth<cpan:TYIL>",
+ "Log:auth<cpan:TYIL>:ver<0.3.0>",
"IO::Glob",
"IRC::TextColor",
"DB::Pg",
diff --git a/lib/Local/Musashi.pm6 b/lib/Local/Musashi.pm6
index bd3235f..84ea1f7 100644
--- a/lib/Local/Musashi.pm6
+++ b/lib/Local/Musashi.pm6
@@ -19,11 +19,9 @@ unit module Local::Musashi;
unit sub MAIN (
) is export {
# Set up logger
- my $*LOG;
-
if (%*ENV<RAKU_LOG_CLASS>:exists) {
- $*LOG = (require ::(%*ENV<RAKU_LOG_CLASS>)).new;
- $*LOG.add-output($*OUT, %*ENV<RAKU_LOG_LEVEL> // Log::Level::Info);
+ $Log::instance = (require ::(%*ENV<RAKU_LOG_CLASS>)).new;
+ $Log::instance.add-output($*OUT, %*ENV<RAKU_LOG_LEVEL> // Log::Level::Info);
}
# Create $bot early to use it in traps
@@ -48,7 +46,7 @@ unit sub MAIN (
my $*CONFIG = Config.new.read($config-file.absolute);
if (!$*CONFIG.get('irc.opers')) {
- .warning('No opers defined in irc.opers') with $*LOG;
+ .warning('No opers defined in irc.opers') with $Log::instance;
}
# Set up database connection
@@ -61,7 +59,7 @@ unit sub MAIN (
try require DB::Pg;
if (DB::Pg ~~ Failure) {
- .emergency('Failed to load DB::Pg') with $*LOG;
+ .emergency('Failed to load DB::Pg') with $Log::instance;
return;
}
@@ -73,12 +71,12 @@ unit sub MAIN (
port => $*CONFIG.get('database.port', 5432),
).pairs.grep(*.value).map({ "{$_.key}={$_.value}" }).join(' ');
- .info("Using Postgres database ($conninfo)") with $*LOG;
+ .info("Using Postgres database ($conninfo)") with $Log::instance;
$*DB = DB::Pg.new(:$conninfo);
}
default {
- .warning("Invalid database driver '$db-driver'") with $*LOG;
+ .warning("Invalid database driver '$db-driver'") with $Log::instance;
}
}
@@ -94,7 +92,7 @@ unit sub MAIN (
for $*CONFIG.get('irc.ignore', []).List -> $bully {
next unless $usermask ~~ glob($bully);
- .notice("$bully is ignored") with $*LOG;
+ .notice("$bully is ignored") with $Log::instance;
return Nil;
}
@@ -149,13 +147,13 @@ unit sub MAIN (
return "I'm sorry, I can't let you do that";
}
- .info('Reloading configuration') with $*LOG;
+ .info('Reloading configuration') with $Log::instance;
$*CONFIG.=read($config-file.absolute);
for @plugins -> $plugin {
next unless $plugin.^can('reload-config');
- .info("Reloading plugin $plugin") with $*LOG;
+ .info("Reloading plugin $plugin") with $Log::instance;
$plugin.reload-config($*CONFIG);
}