mirror of
https://github.com/Seldaek/monolog.git
synced 2025-07-31 18:30:15 +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"
|
||||
dependencies: lowest
|
||||
operating-system: ubuntu-latest
|
||||
- php-version: "8.2"
|
||||
- php-version: "8.4"
|
||||
dependencies: highest
|
||||
operating-system: ubuntu-latest
|
||||
composer-options: "--ignore-platform-req=php+"
|
||||
@@ -50,7 +50,7 @@ jobs:
|
||||
couchdb version: '2.3.1'
|
||||
|
||||
- name: Run MongoDB
|
||||
uses: supercharge/mongodb-github-action@1.7.0
|
||||
uses: supercharge/mongodb-github-action@1.10.0
|
||||
with:
|
||||
mongodb-version: 5.0
|
||||
|
||||
|
1
.github/workflows/lint.yml
vendored
1
.github/workflows/lint.yml
vendored
@@ -17,6 +17,7 @@ jobs:
|
||||
matrix:
|
||||
php-version:
|
||||
- "8.1"
|
||||
- "8.3"
|
||||
|
||||
steps:
|
||||
- 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"
|
||||
|
||||
- name: Cache dependencies
|
||||
uses: actions/cache@v3
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ steps.composercache.outputs.dir }}
|
||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||
|
@@ -27,6 +27,8 @@ class DateTimeImmutable extends \DateTimeImmutable implements \JsonSerializable
|
||||
{
|
||||
$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);
|
||||
}
|
||||
|
||||
|
@@ -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.
|
||||
*/
|
||||
public function getHandler(LogRecord $record = null): HandlerInterface
|
||||
public function getHandler(LogRecord|null $record = null): HandlerInterface
|
||||
{
|
||||
if (!$this->handler instanceof HandlerInterface) {
|
||||
$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.
|
||||
*/
|
||||
public function getHandler(LogRecord $record = null): HandlerInterface
|
||||
public function getHandler(LogRecord|null $record = null): HandlerInterface
|
||||
{
|
||||
if (!$this->handler instanceof HandlerInterface) {
|
||||
$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.
|
||||
*/
|
||||
public function getHandler(LogRecord $record = null): HandlerInterface
|
||||
public function getHandler(LogRecord|null $record = null): HandlerInterface
|
||||
{
|
||||
if (!$this->handler instanceof HandlerInterface) {
|
||||
$handler = ($this->handler)($record, $this);
|
||||
|
@@ -86,7 +86,7 @@ class SlackRecord
|
||||
bool $useShortAttachment = false,
|
||||
bool $includeContextAndExtra = false,
|
||||
array $excludeFields = [],
|
||||
FormatterInterface $formatter = null
|
||||
FormatterInterface|null $formatter = null
|
||||
) {
|
||||
$this
|
||||
->setChannel($channel)
|
||||
|
@@ -111,9 +111,9 @@ class TelegramBotHandler extends AbstractProcessingHandler
|
||||
string $channel,
|
||||
$level = Level::Debug,
|
||||
bool $bubble = true,
|
||||
string $parseMode = null,
|
||||
bool $disableWebPagePreview = null,
|
||||
bool $disableNotification = null,
|
||||
?string $parseMode = null,
|
||||
?bool $disableWebPagePreview = null,
|
||||
?bool $disableNotification = null,
|
||||
bool $splitLongMessages = false,
|
||||
bool $delayBetweenMessages = false,
|
||||
int $topic = null
|
||||
@@ -137,7 +137,7 @@ class TelegramBotHandler extends AbstractProcessingHandler
|
||||
/**
|
||||
* @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)) {
|
||||
throw new \InvalidArgumentException('Unknown parseMode, use one of these: ' . implode(', ', self::AVAILABLE_PARSE_MODES) . '.');
|
||||
@@ -151,7 +151,7 @@ class TelegramBotHandler extends AbstractProcessingHandler
|
||||
/**
|
||||
* @return $this
|
||||
*/
|
||||
public function disableWebPagePreview(bool $disableWebPagePreview = null): self
|
||||
public function disableWebPagePreview(bool|null $disableWebPagePreview = null): self
|
||||
{
|
||||
$this->disableWebPagePreview = $disableWebPagePreview;
|
||||
|
||||
@@ -161,7 +161,7 @@ class TelegramBotHandler extends AbstractProcessingHandler
|
||||
/**
|
||||
* @return $this
|
||||
*/
|
||||
public function disableNotification(bool $disableNotification = null): self
|
||||
public function disableNotification(bool|null $disableNotification = null): self
|
||||
{
|
||||
$this->disableNotification = $disableNotification;
|
||||
|
||||
|
@@ -320,15 +320,15 @@ class Logger implements LoggerInterface, ResettableInterface
|
||||
/**
|
||||
* Adds a log record.
|
||||
*
|
||||
* @param int $level The logging level (a Monolog or RFC 5424 level)
|
||||
* @param string $message The log message
|
||||
* @param mixed[] $context The log context
|
||||
* @param DateTimeImmutable $datetime Optional log date to log into the past or future
|
||||
* @return bool Whether the record has been processed
|
||||
* @param int $level The logging level (a Monolog or RFC 5424 level)
|
||||
* @param string $message The log message
|
||||
* @param mixed[] $context The log context
|
||||
* @param DateTimeImmutable|null $datetime Optional log date to log into the past or future
|
||||
* @return bool Whether the record has been processed
|
||||
*
|
||||
* @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])) {
|
||||
$level = self::RFC_5424_LEVELS[$level];
|
||||
|
@@ -34,7 +34,7 @@ class SignalHandlerTest extends TestCase
|
||||
$this->asyncSignalHandling = pcntl_async_signals();
|
||||
}
|
||||
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);
|
||||
pcntl_signal_dispatch();
|
||||
// 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);
|
||||
posix_kill(posix_getpid(), $signo);
|
||||
pcntl_signal_dispatch();
|
||||
|
Reference in New Issue
Block a user