1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-11 15:44:34 +02:00

Remove LevelName enum in favor of a Level::getName method, fixes #1667 (#1668)

This commit is contained in:
Jordi Boggiano
2022-05-10 11:15:16 +02:00
committed by GitHub
parent d381140ca1
commit 1dacc790b9
65 changed files with 220 additions and 280 deletions

View File

@@ -22,7 +22,6 @@ abstract class provided by Monolog to keep things DRY.
<?php
use Monolog\Level;
use Monolog\LevelName;
use Monolog\Logger;
use Monolog\Handler\AbstractProcessingHandler;
@@ -32,7 +31,7 @@ class PDOHandler extends AbstractProcessingHandler
private PDO $pdo;
private PDOStatement $statement;
public function __construct(PDO $pdo, int|string|Level|LevelName $level = Level::Debug, bool $bubble = true)
public function __construct(PDO $pdo, int|string|Level $level = Level::Debug, bool $bubble = true)
{
$this->pdo = $pdo;
parent::__construct($level, $bubble);

View File

@@ -9,7 +9,6 @@ property | type | description
-----------|---------------------------|-------------------------------------------------------------------------------
message | string | The log message. When the `PsrLogMessageProcessor` is used this string may contain placeholders that will be replaced by variables from the context, e.g., "User {username} logged in" with `['username' => 'John']` as context will be written as "User John logged in".
level | Monolog\Level case | Severity of the log message. See log levels described in [01-usage.md](01-usage.md#log-levels).
levelName | Monolog\LevelName case | String representation of log level.
context | array | Arbitrary data passed with the construction of the message. For example the username of the current user or their IP address.
channel | string | The channel this message was logged to. This is the name that was passed when the logger was created with `new Logger($channel)`.
datetime | Monolog\DateTimeImmutable | Date and time when the message was logged. Class extends `\DateTimeImmutable`.
@@ -22,4 +21,4 @@ and can be filled by processors. The reason processors write to `extra` and not
All properties except `extra` are read-only.
> Note: For BC reasons with Monolog 1 and 2 which used arrays, `LogRecord` implements `ArrayAccess` so you can access the above properties
> using `$record['message']` for example, with the notable exception of `levelName` which must be referred to as `level_name` for BC.
> using `$record['message']` for example, with the notable exception of `level->getName()` which must be referred to as `level_name` for BC.