[GH-ISSUE #829] SlackHandler doesn't use formatter #321

Closed
opened 2026-03-04 02:14:06 +03:00 by kerem · 1 comment
Owner

Originally created by @asterixcapri on GitHub (Jul 28, 2016).
Original GitHub issue: https://github.com/Seldaek/monolog/issues/829

I'm trying to format the message for slack handler with LineFormatter without success.

$logger = new \Monolog\Logger("app");

$slack_handler = new \Monolog\Handler\SlackHandler("TOKEN", "CHANNEL");

$slack_handler->setFormatter(
    new \Monolog\Formatter\LineFormatter("app: %message%")
);

$logger->pushHandler($slack_handler);

$logger->error("MyErrorDescription");

In slack I get "MyErrorDescription" and not "app: MyErrorDescription".

Thanks,
Alex

Originally created by @asterixcapri on GitHub (Jul 28, 2016). Original GitHub issue: https://github.com/Seldaek/monolog/issues/829 I'm trying to format the message for slack handler with LineFormatter without success. ``` $logger = new \Monolog\Logger("app"); $slack_handler = new \Monolog\Handler\SlackHandler("TOKEN", "CHANNEL"); $slack_handler->setFormatter( new \Monolog\Formatter\LineFormatter("app: %message%") ); $logger->pushHandler($slack_handler); $logger->error("MyErrorDescription"); ``` In slack I get "MyErrorDescription" and not "app: MyErrorDescription". Thanks, Alex
kerem closed this issue 2026-03-04 02:14:07 +03:00
Author
Owner

@asterixcapri commented on GitHub (Aug 1, 2016):

Thank you!

<!-- gh-comment-id:236590659 --> @asterixcapri commented on GitHub (Aug 1, 2016): Thank you!
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#321
No description provided.