mirror of
https://github.com/Seldaek/monolog.git
synced 2025-01-17 20:58:32 +01:00
Cleanups
This commit is contained in:
parent
0aef68ce10
commit
a3ba6445a4
@ -19,5 +19,8 @@ parameters:
|
||||
paths:
|
||||
- src/Monolog/Formatter/LineFormatter.php
|
||||
|
||||
# can be removed when rollbar/rollbar can be added as dev require again (needs to allow monolog 3.x)
|
||||
- '#Rollbar\\RollbarLogger#'
|
||||
|
||||
includes:
|
||||
- phpstan-baseline.neon
|
||||
|
@ -78,7 +78,6 @@ class ElasticaFormatter extends NormalizerFormatter
|
||||
$document = new Document();
|
||||
$document->setData($record);
|
||||
if (method_exists($document, 'setType')) {
|
||||
/** @phpstan-ignore-next-line */
|
||||
$document->setType($this->type);
|
||||
}
|
||||
$document->setIndex($this->index);
|
||||
|
@ -421,7 +421,6 @@ class Logger implements LoggerInterface, ResettableInterface
|
||||
{
|
||||
if (is_string($level)) {
|
||||
if (is_numeric($level)) {
|
||||
/** @phpstan-ignore-next-line */
|
||||
return intval($level);
|
||||
}
|
||||
|
||||
|
@ -267,10 +267,10 @@ final class Utils
|
||||
$extra = '';
|
||||
try {
|
||||
if ($record->context) {
|
||||
$context = "\nContext: " . json_encode($record->context);
|
||||
$context = "\nContext: " . json_encode($record->context, JSON_THROW_ON_ERROR);
|
||||
}
|
||||
if ($record->extra) {
|
||||
$extra = "\nExtra: " . json_encode($record->extra);
|
||||
$extra = "\nExtra: " . json_encode($record->extra, JSON_THROW_ON_ERROR);
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
// noop
|
||||
|
@ -253,21 +253,19 @@ class MongoDBFormatterTest extends TestCase
|
||||
|
||||
public function testBsonTypes()
|
||||
{
|
||||
$record = [
|
||||
'message' => 'some log message',
|
||||
'context' => [
|
||||
$record = $this->getRecord(
|
||||
message: 'some log message',
|
||||
context: [
|
||||
'objectid' => new ObjectId(),
|
||||
'nest' => [
|
||||
'timestamp' => new UTCDateTime(),
|
||||
'regex' => new Regex('pattern'),
|
||||
],
|
||||
],
|
||||
'level' => Logger::WARNING,
|
||||
'level_name' => Logger::getLevelName(Logger::WARNING),
|
||||
'channel' => 'test',
|
||||
'datetime' => new \DateTimeImmutable('2016-01-21T21:11:30.123456+00:00'),
|
||||
'extra' => [],
|
||||
];
|
||||
level: Logger::WARNING,
|
||||
channel: 'test',
|
||||
datetime: new \DateTimeImmutable('2016-01-21T21:11:30.123456+00:00'),
|
||||
);
|
||||
|
||||
$formatter = new MongoDBFormatter();
|
||||
$formattedRecord = $formatter->format($record);
|
||||
|
@ -166,9 +166,10 @@ STRING;
|
||||
$this->expectExceptionMessage(($majorVersion >= 8) ? $php8xMessage : $php7xMessage);
|
||||
|
||||
$handler = new StreamHandler('bogus://url');
|
||||
$record = $this->getRecord();
|
||||
$record['context'] = ['foo' => 'bar'];
|
||||
$record['extra'] = [1, 2, 3];
|
||||
$record = $this->getRecord(
|
||||
context: ['foo' => 'bar'],
|
||||
extra: [1, 2, 3],
|
||||
);
|
||||
$handler->handle($record);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user