summaryrefslogtreecommitdiff
path: root/src/Loggr.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/Loggr.php')
-rw-r--r--src/Loggr.php12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/Loggr.php b/src/Loggr.php
index 78b3504..82d5681 100644
--- a/src/Loggr.php
+++ b/src/Loggr.php
@@ -159,8 +159,18 @@ class Loggr implements LoggerInterface
$this->write(Level::Debug, $message, $context);
}
- public function log(mixed $level, \Stringable|string $message, array $context = []): void
+ /**
+ * Logs a message with the specified level and context.
+ *
+ * @param mixed $level The logging level (e.g., error, info, debug).
+ * @param \Stringable|string $message The message to log.
+ * @param mixed $context Optional context information to include in the log.
+ * @return void
+ */
+ public function log(mixed $level, \Stringable|string $message, mixed $context = null): void
{
+ if (!is_string($level) && !is_int($level)) return;
+
$this->trace = debug_backtrace()[0];
$this->write(Level::from($level), $message, $context);
}