diff options
| author | Asko Nõmm <asko@nth.ee> | 2024-11-15 17:36:55 +0200 |
|---|---|---|
| committer | Asko Nõmm <asko@nth.ee> | 2024-11-15 17:36:55 +0200 |
| commit | c6221eb4fe29ddf8a09f7fdb4277758716269bd6 (patch) | |
| tree | 409484067297ec4639acc824faef0870aa31f3a4 /src/Loggr.php | |
| parent | 086d719dc61d2c531e0b9fa51678b8e2f34dafdb (diff) | |
Improve tests.
Diffstat (limited to 'src/Loggr.php')
| -rw-r--r-- | src/Loggr.php | 12 |
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); } |
