mirror of
https://github.com/Seldaek/monolog.git
synced 2026-04-26 16:15:49 +03:00
[PR #846] [MERGED] Add new Slack handlers using Slackbot and webhooks #1379
Labels
No labels
Bug
Documentation
Feature
Needs Work
Support
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/monolog#1379
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Seldaek/monolog/pull/846
Author: @hkdobrev
Created: 9/6/2016
Status: ✅ Merged
Merged: 11/25/2016
Merged by: @Seldaek
Base:
1.x← Head:slack-webhooks📝 Commits (10+)
393e243Add a Slackbot handlerf584e56Extract logic for preparing Slack data to SlackRecord274f778Make channel in SlackRecord optional to allow for webhooks4b671ebAdd a Slack Webhooks handler using the same SlackRecord util0956a74Adds new Slack handlers to the docs115f671Use constants for Slack colors000a219Mark former public methods of SlackHandler as deprecated862c087Expose a getter for the SlackRecord in Slack handlers2d1fbbeMake SlackRecord::stringify() work without a line formatter7c2f58eAdd initial tests for SlackRecord📊 Changes
9 files changed (+1001 additions, -158 deletions)
View changed files
📝
doc/02-handlers-formatters-processors.md(+3 -1)➕
src/Monolog/Handler/Slack/SlackRecord.php(+248 -0)📝
src/Monolog/Handler/SlackHandler.php(+51 -144)➕
src/Monolog/Handler/SlackWebhookHandler.php(+108 -0)➕
src/Monolog/Handler/SlackbotHandler.php(+80 -0)➕
tests/Monolog/Handler/Slack/SlackRecordTest.php(+341 -0)📝
tests/Monolog/Handler/SlackHandlerTest.php(+17 -13)➕
tests/Monolog/Handler/SlackWebhookHandlerTest.php(+106 -0)➕
tests/Monolog/Handler/SlackbotHandlerTest.php(+47 -0)📄 Description
See https://github.com/Seldaek/monolog/issues/743#issuecomment-242994019
This is keeping the previous
SlackHandler, but extracts the message formatting logic and introduces two new Slack handlers:SlackbotHandler- this is the simplest way to log to Slack and most people could use that. It doesn't allow fancy formatting, but has autolinking and the simplest configuration with two clicks in the Slack settings and getting a token.SlackWebhookHandler- This is a bit more advanced as it allows for the same formatting and adding attachements as theSlackHandler, but it uses the Slack Webhooks which are quite easier to set up than the OAuth API. The minimum it requires is a webhook URL which is a retrievable with about two clicks in the Slack settings. Even the channel is optional as it could be configured in the integration.This is probably not the leanest way to implement what we've discussed in https://github.com/Seldaek/monolog/issues/743, but after working at this I believe this is the simplest and the right approach.
While we could implement everything in one handler the API would become horrible and it would be harder to understand from users. Providing choice with simple to use separate classes is better IMHO. Apart from this the
SlackHandlerextends theSocketHandlerand the webhooks and the Slackbot wouldn't work nicely with that.What do you think?
@Seldaek @gkedzierski @Gummibeer @nisbeti
SlackRecordSlackbotHandlerSlackWebhookHandlerSlackHandlerusing the newSlackRecordSlackRecordSlackbotHandlerSlackWebhookHandlerSlackHandler🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.