aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/psr/log/src/LoggerTrait.php
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2022-03-29 11:42:53 +0200
committerMario Vavti <mario@mariovavti.com>2022-03-29 11:42:53 +0200
commit0784cd593a39a4fc297e8a82f7e79bc8019a0868 (patch)
tree22182afb37cf460f8208fff9d276a0672add3185 /vendor/psr/log/src/LoggerTrait.php
parent0e2e9321025f87fe9587f3d183adaea6185e4e20 (diff)
parent9c5d2ee5630dd7033904039dcd1e92db8821b644 (diff)
downloadvolse-hubzilla-0784cd593a39a4fc297e8a82f7e79bc8019a0868.tar.gz
volse-hubzilla-0784cd593a39a4fc297e8a82f7e79bc8019a0868.tar.bz2
volse-hubzilla-0784cd593a39a4fc297e8a82f7e79bc8019a0868.zip
Merge branch '7.2RC'7.2
Diffstat (limited to 'vendor/psr/log/src/LoggerTrait.php')
-rw-r--r--vendor/psr/log/src/LoggerTrait.php142
1 files changed, 142 insertions, 0 deletions
diff --git a/vendor/psr/log/src/LoggerTrait.php b/vendor/psr/log/src/LoggerTrait.php
new file mode 100644
index 000000000..920bda77f
--- /dev/null
+++ b/vendor/psr/log/src/LoggerTrait.php
@@ -0,0 +1,142 @@
+<?php
+
+namespace Psr\Log;
+
+/**
+ * This is a simple Logger trait that classes unable to extend AbstractLogger
+ * (because they extend another class, etc) can include.
+ *
+ * It simply delegates all log-level-specific methods to the `log` method to
+ * reduce boilerplate code that a simple Logger that does the same thing with
+ * messages regardless of the error level has to implement.
+ */
+trait LoggerTrait
+{
+ /**
+ * System is unusable.
+ *
+ * @param string|\Stringable $message
+ * @param array $context
+ *
+ * @return void
+ */
+ public function emergency(string|\Stringable $message, array $context = [])
+ {
+ $this->log(LogLevel::EMERGENCY, $message, $context);
+ }
+
+ /**
+ * Action must be taken immediately.
+ *
+ * Example: Entire website down, database unavailable, etc. This should
+ * trigger the SMS alerts and wake you up.
+ *
+ * @param string|\Stringable $message
+ * @param array $context
+ *
+ * @return void
+ */
+ public function alert(string|\Stringable $message, array $context = [])
+ {
+ $this->log(LogLevel::ALERT, $message, $context);
+ }
+
+ /**
+ * Critical conditions.
+ *
+ * Example: Application component unavailable, unexpected exception.
+ *
+ * @param string|\Stringable $message
+ * @param array $context
+ *
+ * @return void
+ */
+ public function critical(string|\Stringable $message, array $context = [])
+ {
+ $this->log(LogLevel::CRITICAL, $message, $context);
+ }
+
+ /**
+ * Runtime errors that do not require immediate action but should typically
+ * be logged and monitored.
+ *
+ * @param string|\Stringable $message
+ * @param array $context
+ *
+ * @return void
+ */
+ public function error(string|\Stringable $message, array $context = [])
+ {
+ $this->log(LogLevel::ERROR, $message, $context);
+ }
+
+ /**
+ * Exceptional occurrences that are not errors.
+ *
+ * Example: Use of deprecated APIs, poor use of an API, undesirable things
+ * that are not necessarily wrong.
+ *
+ * @param string|\Stringable $message
+ * @param array $context
+ *
+ * @return void
+ */
+ public function warning(string|\Stringable $message, array $context = [])
+ {
+ $this->log(LogLevel::WARNING, $message, $context);
+ }
+
+ /**
+ * Normal but significant events.
+ *
+ * @param string|\Stringable $message
+ * @param array $context
+ *
+ * @return void
+ */
+ public function notice(string|\Stringable $message, array $context = [])
+ {
+ $this->log(LogLevel::NOTICE, $message, $context);
+ }
+
+ /**
+ * Interesting events.
+ *
+ * Example: User logs in, SQL logs.
+ *
+ * @param string|\Stringable $message
+ * @param array $context
+ *
+ * @return void
+ */
+ public function info(string|\Stringable $message, array $context = [])
+ {
+ $this->log(LogLevel::INFO, $message, $context);
+ }
+
+ /**
+ * Detailed debug information.
+ *
+ * @param string|\Stringable $message
+ * @param array $context
+ *
+ * @return void
+ */
+ public function debug(string|\Stringable $message, array $context = [])
+ {
+ $this->log(LogLevel::DEBUG, $message, $context);
+ }
+
+ /**
+ * Logs with an arbitrary level.
+ *
+ * @param mixed $level
+ * @param string|\Stringable $message
+ * @param array $context
+ *
+ * @return void
+ *
+ * @throws \Psr\Log\InvalidArgumentException
+ */
+ abstract public function log($level, string|\Stringable $message, array $context = []);
+}