[PR #894] [MERGED] Slack improvements #1402

Closed
opened 2026-03-04 03:12:07 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Seldaek/monolog/pull/894
Author: @mintobit
Created: 11/27/2016
Status: Merged
Merged: 12/13/2016
Merged by: @Seldaek

Base: 1.xHead: slack_improvements


📝 Commits (8)

  • 97864e1 Apply formatter only when useAttachment == false
  • 427e460 Show time within attachment footer
  • 75647cc Support url for user icon
  • aacf9c6 Improve array formatting for context/extra
  • 1a60ad2 Make username optional
  • 945040d Support extra/context field blacklisting
  • 35b97d4 Update Slack related tests
  • 3fa1df3 Call json_encode in php < 5.4 compatible way

📊 Changes

5 files changed (+201 additions, -104 deletions)

View changed files

📝 src/Monolog/Handler/Slack/SlackRecord.php (+87 -41)
📝 src/Monolog/Handler/SlackHandler.php (+4 -2)
📝 src/Monolog/Handler/SlackWebhookHandler.php (+4 -2)
📝 tests/Monolog/Handler/Slack/SlackRecordTest.php (+101 -55)
📝 tests/Monolog/Handler/SlackWebhookHandlerTest.php (+5 -4)

📄 Description

While #846 was focused on providing the ability to communicate with Slack via webhooks/bot, there's a bunch of improvements that can be done before 2.x. Thanks to @greeny, @websirnik, @jewome62 and @mirfilip for ideas.

  • Exclude extra/context, datetime, level from message when attachment is used
  • Use ts attachment key to display datetime considering user timezone
  • Support custom user images
  • Allow to setup username from slack
  • Improve array formatting within context/extra
  • Support include_stacktraces option when attachment is not used and always include stacktraces when attachment is used
  • Support extra/context field exclusion
  • Update tests

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Seldaek/monolog/pull/894 **Author:** [@mintobit](https://github.com/mintobit) **Created:** 11/27/2016 **Status:** ✅ Merged **Merged:** 12/13/2016 **Merged by:** [@Seldaek](https://github.com/Seldaek) **Base:** `1.x` ← **Head:** `slack_improvements` --- ### 📝 Commits (8) - [`97864e1`](https://github.com/Seldaek/monolog/commit/97864e1a7b8fa4a8520bbef8b9dee12666ddcc05) Apply formatter only when useAttachment == false - [`427e460`](https://github.com/Seldaek/monolog/commit/427e460baad6133eb931b7fbd495993162798733) Show time within attachment footer - [`75647cc`](https://github.com/Seldaek/monolog/commit/75647cc203e03d4c6cb4364481de8ff74b564676) Support url for user icon - [`aacf9c6`](https://github.com/Seldaek/monolog/commit/aacf9c646926a9c2af6286ab95871fbc41112e3b) Improve array formatting for context/extra - [`1a60ad2`](https://github.com/Seldaek/monolog/commit/1a60ad2173cc5b8b9dfd2fcc5aafad4813bd5be5) Make username optional - [`945040d`](https://github.com/Seldaek/monolog/commit/945040d3ecbe475122db552d2a0f76cc7c3efc45) Support extra/context field blacklisting - [`35b97d4`](https://github.com/Seldaek/monolog/commit/35b97d4f7e0a4020c98fa8d53de394d4ca309baa) Update Slack related tests - [`3fa1df3`](https://github.com/Seldaek/monolog/commit/3fa1df304f7360226f3fd6f01518b4a6e8df0e75) Call json_encode in php < 5.4 compatible way ### 📊 Changes **5 files changed** (+201 additions, -104 deletions) <details> <summary>View changed files</summary> 📝 `src/Monolog/Handler/Slack/SlackRecord.php` (+87 -41) 📝 `src/Monolog/Handler/SlackHandler.php` (+4 -2) 📝 `src/Monolog/Handler/SlackWebhookHandler.php` (+4 -2) 📝 `tests/Monolog/Handler/Slack/SlackRecordTest.php` (+101 -55) 📝 `tests/Monolog/Handler/SlackWebhookHandlerTest.php` (+5 -4) </details> ### 📄 Description While #846 was focused on providing the ability to communicate with Slack via webhooks/bot, there's a bunch of improvements that can be done before 2.x. Thanks to @greeny, @websirnik, @jewome62 and @mirfilip for ideas. - [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 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-04 03:12:07 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/monolog#1402
No description provided.