aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPatrick Spek <p.spek@tyil.nl>2020-04-20 10:53:22 +0200
committerPatrick Spek <p.spek@tyil.nl>2020-04-20 10:53:22 +0200
commit8b3b434aaf1b4dc52f1278dac52d83de70b029df (patch)
tree049416ecdea52cfdd2399cc88be8f7ac703d55f3 /lib
Initial commit
Diffstat (limited to 'lib')
-rw-r--r--lib/Log.rakumod56
-rw-r--r--lib/Log/Level.rakumod40
2 files changed, 96 insertions, 0 deletions
diff --git a/lib/Log.rakumod b/lib/Log.rakumod
new file mode 100644
index 0000000..e0ecb8d
--- /dev/null
+++ b/lib/Log.rakumod
@@ -0,0 +1,56 @@
+#! /usr/bin/env false
+
+use v6.d;
+
+use Log::Level;
+
+unit role Log;
+
+# Methods for handling plain string messages.
+multi method emergency (Str:D $) { * }
+multi method alert (Str:D $) { * }
+multi method critical (Str:D $) { * }
+multi method error (Str:D $) { * }
+multi method warning (Str:D $) { * }
+multi method notice (Str:D $) { * }
+multi method info (Str:D $) { * }
+multi method debug (Str:D $) { * }
+
+# Methods for handling formatted messages.
+multi method emergency (Str:D $, *@) { * }
+multi method alert (Str:D $, *@) { * }
+multi method critical (Str:D $, *@) { * }
+multi method error (Str:D $, *@) { * }
+multi method warning (Str:D $, *@) { * }
+multi method notice (Str:D $, *@) { * }
+multi method info (Str:D $, *@) { * }
+multi method debug (Str:D $, *@) { * }
+
+# Method for configuration
+multi method add-output (IO::Handle:D $, Int() $ where Log::Level::Emergency ≤ * ≤ Log::Level::Debug, Callable $?) { * }
+
+=begin pod
+
+=NAME Log
+=VERSION 0.0.0
+=AUTHOR Patrick Spek <p.spek@tyil.nl>
+
+=begin LICENSE
+Copyright © 2020
+
+This program is free software: you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free
+Software Foundation, version 3.
+
+This program is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+details.
+
+You should have received a copy of the GNU Lesser General Public License along
+with this program. If not, see http://www.gnu.org/licenses/.
+=end LICENSE
+
+=end pod
+
+# vim: ft=raku noet sw=8 ts=8
diff --git a/lib/Log/Level.rakumod b/lib/Log/Level.rakumod
new file mode 100644
index 0000000..3c57adf
--- /dev/null
+++ b/lib/Log/Level.rakumod
@@ -0,0 +1,40 @@
+#! /usr/bin/env false
+
+use v6.d;
+
+enum Log::Level <
+ Emergency
+ Alert
+ Critical
+ Error
+ Warning
+ Notice
+ Info
+ Debug
+>;
+
+=begin pod
+
+=NAME Log::Level
+=VERSION 0.0.0
+=AUTHOR Patrick Spek <p.spek@tyil.nl>
+
+=begin LICENSE
+Copyright © 2020
+
+This program is free software: you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free
+Software Foundation, version 3.
+
+This program is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+details.
+
+You should have received a copy of the GNU Lesser General Public License along
+with this program. If not, see http://www.gnu.org/licenses/.
+=end LICENSE
+
+=end pod
+
+# vim: ft=raku noet sw=8 ts=8