mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-03 03:37:34 +02:00
Merge branch '2.x'
This commit is contained in:
4
.github/workflows/continuous-integration.yml
vendored
4
.github/workflows/continuous-integration.yml
vendored
@@ -33,7 +33,7 @@ jobs:
|
|||||||
- php-version: "8.1"
|
- php-version: "8.1"
|
||||||
dependencies: lowest
|
dependencies: lowest
|
||||||
operating-system: ubuntu-latest
|
operating-system: ubuntu-latest
|
||||||
- php-version: "8.2"
|
- php-version: "8.4"
|
||||||
dependencies: highest
|
dependencies: highest
|
||||||
operating-system: ubuntu-latest
|
operating-system: ubuntu-latest
|
||||||
composer-options: "--ignore-platform-req=php+"
|
composer-options: "--ignore-platform-req=php+"
|
||||||
@@ -50,7 +50,7 @@ jobs:
|
|||||||
couchdb version: '2.3.1'
|
couchdb version: '2.3.1'
|
||||||
|
|
||||||
- name: Run MongoDB
|
- name: Run MongoDB
|
||||||
uses: supercharge/mongodb-github-action@1.7.0
|
uses: supercharge/mongodb-github-action@1.10.0
|
||||||
with:
|
with:
|
||||||
mongodb-version: 5.0
|
mongodb-version: 5.0
|
||||||
|
|
||||||
|
1
.github/workflows/lint.yml
vendored
1
.github/workflows/lint.yml
vendored
@@ -17,6 +17,7 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
php-version:
|
php-version:
|
||||||
- "8.1"
|
- "8.1"
|
||||||
|
- "8.3"
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: "Checkout"
|
- name: "Checkout"
|
||||||
|
2
.github/workflows/phpstan.yml
vendored
2
.github/workflows/phpstan.yml
vendored
@@ -37,7 +37,7 @@ jobs:
|
|||||||
run: echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"
|
run: echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
- name: Cache dependencies
|
- name: Cache dependencies
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.composercache.outputs.dir }}
|
path: ${{ steps.composercache.outputs.dir }}
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
|
@@ -27,6 +27,8 @@ class DateTimeImmutable extends \DateTimeImmutable implements \JsonSerializable
|
|||||||
{
|
{
|
||||||
$this->useMicroseconds = $useMicroseconds;
|
$this->useMicroseconds = $useMicroseconds;
|
||||||
|
|
||||||
|
// if you like to use a custom time to pass to Logger::addRecord directly,
|
||||||
|
// call modify() or setTimestamp() on this instance to change the date after creating it
|
||||||
parent::__construct('now', $timezone);
|
parent::__construct('now', $timezone);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -150,7 +150,7 @@ class FilterHandler extends Handler implements ProcessableHandlerInterface, Rese
|
|||||||
*
|
*
|
||||||
* If the handler was provided as a factory, this will trigger the handler's instantiation.
|
* If the handler was provided as a factory, this will trigger the handler's instantiation.
|
||||||
*/
|
*/
|
||||||
public function getHandler(LogRecord $record = null): HandlerInterface
|
public function getHandler(LogRecord|null $record = null): HandlerInterface
|
||||||
{
|
{
|
||||||
if (!$this->handler instanceof HandlerInterface) {
|
if (!$this->handler instanceof HandlerInterface) {
|
||||||
$handler = ($this->handler)($record, $this);
|
$handler = ($this->handler)($record, $this);
|
||||||
|
@@ -199,7 +199,7 @@ class FingersCrossedHandler extends Handler implements ProcessableHandlerInterfa
|
|||||||
*
|
*
|
||||||
* If the handler was provided as a factory, this will trigger the handler's instantiation.
|
* If the handler was provided as a factory, this will trigger the handler's instantiation.
|
||||||
*/
|
*/
|
||||||
public function getHandler(LogRecord $record = null): HandlerInterface
|
public function getHandler(LogRecord|null $record = null): HandlerInterface
|
||||||
{
|
{
|
||||||
if (!$this->handler instanceof HandlerInterface) {
|
if (!$this->handler instanceof HandlerInterface) {
|
||||||
$handler = ($this->handler)($record, $this);
|
$handler = ($this->handler)($record, $this);
|
||||||
|
@@ -78,7 +78,7 @@ class SamplingHandler extends AbstractHandler implements ProcessableHandlerInter
|
|||||||
*
|
*
|
||||||
* If the handler was provided as a factory, this will trigger the handler's instantiation.
|
* If the handler was provided as a factory, this will trigger the handler's instantiation.
|
||||||
*/
|
*/
|
||||||
public function getHandler(LogRecord $record = null): HandlerInterface
|
public function getHandler(LogRecord|null $record = null): HandlerInterface
|
||||||
{
|
{
|
||||||
if (!$this->handler instanceof HandlerInterface) {
|
if (!$this->handler instanceof HandlerInterface) {
|
||||||
$handler = ($this->handler)($record, $this);
|
$handler = ($this->handler)($record, $this);
|
||||||
|
@@ -86,7 +86,7 @@ class SlackRecord
|
|||||||
bool $useShortAttachment = false,
|
bool $useShortAttachment = false,
|
||||||
bool $includeContextAndExtra = false,
|
bool $includeContextAndExtra = false,
|
||||||
array $excludeFields = [],
|
array $excludeFields = [],
|
||||||
FormatterInterface $formatter = null
|
FormatterInterface|null $formatter = null
|
||||||
) {
|
) {
|
||||||
$this
|
$this
|
||||||
->setChannel($channel)
|
->setChannel($channel)
|
||||||
|
@@ -111,9 +111,9 @@ class TelegramBotHandler extends AbstractProcessingHandler
|
|||||||
string $channel,
|
string $channel,
|
||||||
$level = Level::Debug,
|
$level = Level::Debug,
|
||||||
bool $bubble = true,
|
bool $bubble = true,
|
||||||
string $parseMode = null,
|
?string $parseMode = null,
|
||||||
bool $disableWebPagePreview = null,
|
?bool $disableWebPagePreview = null,
|
||||||
bool $disableNotification = null,
|
?bool $disableNotification = null,
|
||||||
bool $splitLongMessages = false,
|
bool $splitLongMessages = false,
|
||||||
bool $delayBetweenMessages = false,
|
bool $delayBetweenMessages = false,
|
||||||
int $topic = null
|
int $topic = null
|
||||||
@@ -137,7 +137,7 @@ class TelegramBotHandler extends AbstractProcessingHandler
|
|||||||
/**
|
/**
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setParseMode(string $parseMode = null): self
|
public function setParseMode(string|null $parseMode = null): self
|
||||||
{
|
{
|
||||||
if ($parseMode !== null && !in_array($parseMode, self::AVAILABLE_PARSE_MODES, true)) {
|
if ($parseMode !== null && !in_array($parseMode, self::AVAILABLE_PARSE_MODES, true)) {
|
||||||
throw new \InvalidArgumentException('Unknown parseMode, use one of these: ' . implode(', ', self::AVAILABLE_PARSE_MODES) . '.');
|
throw new \InvalidArgumentException('Unknown parseMode, use one of these: ' . implode(', ', self::AVAILABLE_PARSE_MODES) . '.');
|
||||||
@@ -151,7 +151,7 @@ class TelegramBotHandler extends AbstractProcessingHandler
|
|||||||
/**
|
/**
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function disableWebPagePreview(bool $disableWebPagePreview = null): self
|
public function disableWebPagePreview(bool|null $disableWebPagePreview = null): self
|
||||||
{
|
{
|
||||||
$this->disableWebPagePreview = $disableWebPagePreview;
|
$this->disableWebPagePreview = $disableWebPagePreview;
|
||||||
|
|
||||||
@@ -161,7 +161,7 @@ class TelegramBotHandler extends AbstractProcessingHandler
|
|||||||
/**
|
/**
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function disableNotification(bool $disableNotification = null): self
|
public function disableNotification(bool|null $disableNotification = null): self
|
||||||
{
|
{
|
||||||
$this->disableNotification = $disableNotification;
|
$this->disableNotification = $disableNotification;
|
||||||
|
|
||||||
|
@@ -323,12 +323,12 @@ class Logger implements LoggerInterface, ResettableInterface
|
|||||||
* @param int $level The logging level (a Monolog or RFC 5424 level)
|
* @param int $level The logging level (a Monolog or RFC 5424 level)
|
||||||
* @param string $message The log message
|
* @param string $message The log message
|
||||||
* @param mixed[] $context The log context
|
* @param mixed[] $context The log context
|
||||||
* @param DateTimeImmutable $datetime Optional log date to log into the past or future
|
* @param DateTimeImmutable|null $datetime Optional log date to log into the past or future
|
||||||
* @return bool Whether the record has been processed
|
* @return bool Whether the record has been processed
|
||||||
*
|
*
|
||||||
* @phpstan-param value-of<Level::VALUES>|Level $level
|
* @phpstan-param value-of<Level::VALUES>|Level $level
|
||||||
*/
|
*/
|
||||||
public function addRecord(int|Level $level, string $message, array $context = [], DateTimeImmutable $datetime = null): bool
|
public function addRecord(int|Level $level, string $message, array $context = [], DateTimeImmutable|null $datetime = null): bool
|
||||||
{
|
{
|
||||||
if (is_int($level) && isset(self::RFC_5424_LEVELS[$level])) {
|
if (is_int($level) && isset(self::RFC_5424_LEVELS[$level])) {
|
||||||
$level = self::RFC_5424_LEVELS[$level];
|
$level = self::RFC_5424_LEVELS[$level];
|
||||||
|
@@ -34,7 +34,7 @@ class SignalHandlerTest extends TestCase
|
|||||||
$this->asyncSignalHandling = pcntl_async_signals();
|
$this->asyncSignalHandling = pcntl_async_signals();
|
||||||
}
|
}
|
||||||
if (function_exists('pcntl_sigprocmask')) {
|
if (function_exists('pcntl_sigprocmask')) {
|
||||||
pcntl_sigprocmask(SIG_BLOCK, [], $this->blockedSignals);
|
pcntl_sigprocmask(SIG_SETMASK, [], $this->blockedSignals);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -146,7 +146,7 @@ class SignalHandlerTest extends TestCase
|
|||||||
posix_kill(posix_getpid(), $signo);
|
posix_kill(posix_getpid(), $signo);
|
||||||
pcntl_signal_dispatch();
|
pcntl_signal_dispatch();
|
||||||
// If $callPrevious is true, SIGINT should terminate by this line.
|
// If $callPrevious is true, SIGINT should terminate by this line.
|
||||||
pcntl_sigprocmask(SIG_BLOCK, [], $oldset);
|
pcntl_sigprocmask(SIG_SETMASK, [], $oldset);
|
||||||
file_put_contents($path, implode(' ', $oldset), FILE_APPEND);
|
file_put_contents($path, implode(' ', $oldset), FILE_APPEND);
|
||||||
posix_kill(posix_getpid(), $signo);
|
posix_kill(posix_getpid(), $signo);
|
||||||
pcntl_signal_dispatch();
|
pcntl_signal_dispatch();
|
||||||
|
Reference in New Issue
Block a user