1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-02 11:20:31 +02:00
This commit is contained in:
Jordi Boggiano
2021-05-28 22:07:02 +02:00
parent 13d40f953f
commit 4ef5da80ad
26 changed files with 48 additions and 43 deletions

View File

@@ -77,7 +77,7 @@ class ElasticaFormatter extends NormalizerFormatter
{ {
$document = new Document(); $document = new Document();
$document->setData($record); $document->setData($record);
if(method_exists($document, 'setType')) { if (method_exists($document, 'setType')) {
$document->setType($this->type); $document->setType($this->type);
} }
$document->setIndex($this->index); $document->setIndex($this->index);

View File

@@ -65,6 +65,7 @@ class FirePHPHandler extends AbstractProcessingHandler
* *
* @param array<int|string> $meta Wildfire Plugin, Protocol & Structure Indexes * @param array<int|string> $meta Wildfire Plugin, Protocol & Structure Indexes
* @param string $message Log message * @param string $message Log message
*
* @return array<string, string> Complete header string ready for the client as key and message as value * @return array<string, string> Complete header string ready for the client as key and message as value
*/ */
protected function createHeader(array $meta, string $message): array protected function createHeader(array $meta, string $message): array

View File

@@ -86,6 +86,7 @@ class PHPConsoleHandler extends AbstractProcessingHandler
/** /**
* @param array<string, mixed> $options * @param array<string, mixed> $options
*
* @return array<string, mixed> * @return array<string, mixed>
*/ */
private function initOptions(array $options): array private function initOptions(array $options): array

View File

@@ -316,6 +316,7 @@ class SlackRecord
* Generates attachment field * Generates attachment field
* *
* @param string|mixed[] $value * @param string|mixed[] $value
*
* @return array{title: string, value: string, short: false} * @return array{title: string, value: string, short: false}
*/ */
private function generateAttachmentField(string $title, $value): array private function generateAttachmentField(string $title, $value): array
@@ -335,6 +336,7 @@ class SlackRecord
* Generates a collection of attachment fields from array * Generates a collection of attachment fields from array
* *
* @param mixed[] $data * @param mixed[] $data
*
* @return array<array{title: string, value: string, short: false}> * @return array<array{title: string, value: string, short: false}>
*/ */
private function generateAttachmentFields(array $data): array private function generateAttachmentFields(array $data): array
@@ -351,6 +353,7 @@ class SlackRecord
* Get a copy of record with fields excluded according to $this->excludeFields * Get a copy of record with fields excluded according to $this->excludeFields
* *
* @phpstan-param FormattedRecord $record * @phpstan-param FormattedRecord $record
*
* @return mixed[] * @return mixed[]
*/ */
private function removeExcludedFields(array $record): array private function removeExcludedFields(array $record): array

View File

@@ -38,7 +38,7 @@ class TelegramBotHandler extends AbstractProcessingHandler
private const AVAILABLE_PARSE_MODES = [ private const AVAILABLE_PARSE_MODES = [
'HTML', 'HTML',
'MarkdownV2', 'MarkdownV2',
'Markdown' // legacy mode without underline and strikethrough, use MarkdownV2 instead 'Markdown', // legacy mode without underline and strikethrough, use MarkdownV2 instead
]; ];
/** /**
@@ -104,18 +104,21 @@ class TelegramBotHandler extends AbstractProcessingHandler
} }
$this->parseMode = $parseMode; $this->parseMode = $parseMode;
return $this; return $this;
} }
public function disableWebPagePreview(bool $disableWebPagePreview = null): self public function disableWebPagePreview(bool $disableWebPagePreview = null): self
{ {
$this->disableWebPagePreview = $disableWebPagePreview; $this->disableWebPagePreview = $disableWebPagePreview;
return $this; return $this;
} }
public function disableNotification(bool $disableNotification = null): self public function disableNotification(bool $disableNotification = null): self
{ {
$this->disableNotification = $disableNotification; $this->disableNotification = $disableNotification;
return $this; return $this;
} }

View File

@@ -56,7 +56,7 @@ class ElasticaFormatterTest extends \PHPUnit\Framework\TestCase
// Document parameters // Document parameters
$this->assertEquals('my_index', $doc->getIndex()); $this->assertEquals('my_index', $doc->getIndex());
if(method_exists($doc, 'getType')) { if (method_exists($doc, 'getType')) {
$this->assertEquals('doc_type', $doc->getType()); $this->assertEquals('doc_type', $doc->getType());
} }

View File

@@ -263,7 +263,6 @@ class ElasticaHandlerTest extends TestCase
$client->request("/{$this->options['index']}", Request::DELETE); $client->request("/{$this->options['index']}", Request::DELETE);
} }
/** /**
* Return last created document id from ES response * Return last created document id from ES response
* @param Response $response Elastica Response object * @param Response $response Elastica Response object
@@ -287,7 +286,7 @@ class ElasticaHandlerTest extends TestCase
*/ */
protected function getDocSourceFromElastic(Client $client, $index, $type, $documentId) protected function getDocSourceFromElastic(Client $client, $index, $type, $documentId)
{ {
if($type === null) { if ($type === null) {
$path = "/{$index}/_doc/{$documentId}"; $path = "/{$index}/_doc/{$documentId}";
} else { } else {
$path = "/{$index}/{$type}/{$documentId}"; $path = "/{$index}/{$type}/{$documentId}";

View File

@@ -13,7 +13,6 @@ namespace Monolog\Handler;
use MongoDB\Driver\Manager; use MongoDB\Driver\Manager;
use Monolog\Test\TestCase; use Monolog\Test\TestCase;
use Monolog\Formatter\NormalizerFormatter;
class MongoDBHandlerTest extends TestCase class MongoDBHandlerTest extends TestCase
{ {

View File

@@ -41,8 +41,7 @@ class TelegramBotHandlerTest extends TestCase
string $parseMode = 'Markdown', string $parseMode = 'Markdown',
bool $disableWebPagePreview = false, bool $disableWebPagePreview = false,
bool $disableNotification = true bool $disableNotification = true
): void ): void {
{
$constructorArgs = [$apiKey, $channel, Logger::DEBUG, true, $parseMode, $disableWebPagePreview, $disableNotification]; $constructorArgs = [$apiKey, $channel, Logger::DEBUG, true, $parseMode, $disableWebPagePreview, $disableNotification];
$this->handler = $this->getMockBuilder(TelegramBotHandler::class) $this->handler = $this->getMockBuilder(TelegramBotHandler::class)