From c6221eb4fe29ddf8a09f7fdb4277758716269bd6 Mon Sep 17 00:00:00 2001 From: Asko Nõmm Date: Fri, 15 Nov 2024 17:36:55 +0200 Subject: Improve tests. --- src/Loggr.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/Loggr.php') 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); } -- cgit v1.2.3