mirror of
https://github.com/Seldaek/monolog.git
synced 2025-10-25 10:36:33 +02:00
Merge branch '1.x'
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
|
||||
namespace Monolog\Formatter;
|
||||
|
||||
use Monolog\Utils;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
@@ -166,7 +167,7 @@ class JsonFormatter extends NormalizerFormatter
|
||||
protected function normalizeException(Throwable $e, int $depth = 0): array
|
||||
{
|
||||
$data = [
|
||||
'class' => get_class($e),
|
||||
'class' => Utils::getClass($e),
|
||||
'message' => $e->getMessage(),
|
||||
'code' => $e->getCode(),
|
||||
'file' => $e->getFile().':'.$e->getLine(),
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
|
||||
namespace Monolog\Formatter;
|
||||
|
||||
use Monolog\Utils;
|
||||
|
||||
/**
|
||||
* Formats incoming records into a one-line string
|
||||
*
|
||||
@@ -168,7 +170,7 @@ class LineFormatter extends NormalizerFormatter
|
||||
|
||||
private function formatException(\Throwable $e): string
|
||||
{
|
||||
$str = '[object] (' . get_class($e) . '(code: ' . $e->getCode() . '): ' . $e->getMessage() . ' at ' . $e->getFile() . ':' . $e->getLine() . ')';
|
||||
$str = '[object] (' . Utils::getClass($e) . '(code: ' . $e->getCode() . '): ' . $e->getMessage() . ' at ' . $e->getFile() . ':' . $e->getLine() . ')';
|
||||
if ($this->includeStacktraces) {
|
||||
$str .= "\n[stacktrace]\n" . $e->getTraceAsString() . "\n";
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
namespace Monolog\Formatter;
|
||||
|
||||
use MongoDB\BSON\UTCDateTime;
|
||||
use Monolog\Utils;
|
||||
|
||||
/**
|
||||
* Formats a record for use with the MongoDBHandler.
|
||||
@@ -83,7 +84,7 @@ class MongoDBFormatter implements FormatterInterface
|
||||
protected function formatObject($value, int $nestingLevel)
|
||||
{
|
||||
$objectVars = get_object_vars($value);
|
||||
$objectVars['class'] = get_class($value);
|
||||
$objectVars['class'] = Utils::getClass($value);
|
||||
|
||||
return $this->formatArray($objectVars, $nestingLevel);
|
||||
}
|
||||
@@ -91,7 +92,7 @@ class MongoDBFormatter implements FormatterInterface
|
||||
protected function formatException(\Throwable $exception, int $nestingLevel)
|
||||
{
|
||||
$formattedException = [
|
||||
'class' => get_class($exception),
|
||||
'class' => Utils::getClass($exception),
|
||||
'message' => $exception->getMessage(),
|
||||
'code' => $exception->getCode(),
|
||||
'file' => $exception->getFile() . ':' . $exception->getLine(),
|
||||
|
||||
@@ -13,6 +13,7 @@ namespace Monolog\Formatter;
|
||||
|
||||
use Throwable;
|
||||
use Monolog\DateTimeImmutable;
|
||||
use Monolog\Utils;
|
||||
|
||||
/**
|
||||
* Normalizes incoming records to remove objects/resources so it's easier to dump to various targets
|
||||
@@ -146,7 +147,7 @@ class NormalizerFormatter implements FormatterInterface
|
||||
}
|
||||
}
|
||||
|
||||
return [get_class($data) => $value];
|
||||
return [Utils::getClass($data) => $value];
|
||||
}
|
||||
|
||||
if (is_resource($data)) {
|
||||
@@ -162,7 +163,7 @@ class NormalizerFormatter implements FormatterInterface
|
||||
protected function normalizeException(Throwable $e, int $depth = 0)
|
||||
{
|
||||
$data = [
|
||||
'class' => get_class($e),
|
||||
'class' => Utils::getClass($e),
|
||||
'message' => $e->getMessage(),
|
||||
'code' => $e->getCode(),
|
||||
'file' => $e->getFile().':'.$e->getLine(),
|
||||
@@ -195,7 +196,7 @@ class NormalizerFormatter implements FormatterInterface
|
||||
// as a class name to avoid any unexpected leak of sensitive information
|
||||
$frame['args'] = array_map(function ($arg) {
|
||||
if (is_object($arg) && !$arg instanceof \DateTimeInterface) {
|
||||
return sprintf("[object] (%s)", get_class($arg));
|
||||
return sprintf("[object] (%s)", Utils::getClass($arg));
|
||||
}
|
||||
|
||||
return $arg;
|
||||
|
||||
Reference in New Issue
Block a user