1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-10-19 07:36:17 +02:00

Slack improvements (#894)

- [x] Exclude `extra`/`context`, `datetime`, `level` from message when attachment is used
- [x] Use `ts` attachment key to display `datetime` considering user timezone
- [x] [Support](https://github.com/Seldaek/monolog/pull/846#issuecomment-249528719) custom user images
- [x] [Allow](https://github.com/Seldaek/monolog/pull/894#issuecomment-263532399) to setup username from slack
- [x] [Improve](https://github.com/Seldaek/monolog/pull/846#issuecomment-261529198) array formatting within `context`/`extra`
- [x] [Support](https://github.com/Seldaek/monolog/issues/745) `include_stacktraces` option when attachment is not used and always include stacktraces when attachment is used
- [x] Support `extra`/`context` field exclusion
- [x] Update tests
This commit is contained in:
Anton Nizhegorodov
2016-12-13 16:25:55 +02:00
committed by Jordi Boggiano
parent fdd6780ffd
commit b732364e70
5 changed files with 201 additions and 104 deletions

View File

@@ -32,11 +32,10 @@ class SlackWebhookHandlerTest extends TestCase
public function testConstructorMinimal()
{
$handler = new SlackWebhookHandler(self::WEBHOOK_URL);
$record = $this->getRecord();
$slackRecord = $handler->getSlackRecord();
$this->assertInstanceOf('Monolog\Handler\Slack\SlackRecord', $slackRecord);
$this->assertEquals(array(
'username' => 'Monolog',
'text' => '',
'attachments' => array(
array(
'fallback' => 'test',
@@ -46,13 +45,15 @@ class SlackWebhookHandlerTest extends TestCase
array(
'title' => 'Level',
'value' => 'WARNING',
'short' => true,
'short' => false,
),
),
'title' => 'Message',
'mrkdwn_in' => array('fields'),
'ts' => $record['datetime']->getTimestamp(),
),
),
), $slackRecord->getSlackData($this->getRecord()));
), $slackRecord->getSlackData($record));
}
/**