Skip to content

Slackhandler, cannot simply display the message #902

@riccardomessineo

Description

@riccardomessineo

Hi,
I've already posted a PR to fix this problem but with the new release my changes were overwritten (issue #871 and PR #872).
I want the SlackHandler to print the simple message, without formatting anything (I've already set the processors to do that).

By this settings:

        $slackInfoHandler = new \Monolog\Handler\SlackHandler($slackToken, $infoChannel, 'Swite API Logger', true, $slackEmoji, $infoLevel, $infoBubble, false, true);
        $slackInfoHandler->pushProcessor(new \Monolog\Processor\WebProcessor);
        $slackInfoHandler->pushProcessor(new \Monolog\Processor\IntrospectionProcessor);
        $monolog->pushHandler($slackInfoHandler);

I'm outputting this kind of errors:
schermata 2016-12-12 alle 16 06 51

I think the problem lies in this piece of code (SlackRecord):

        if ($this->formatter) {
            $message = $this->formatter->format($record);
        } else {
            $message = $record['message'];
        }

Because Formatter is always declared (code of SlackHandler):

    public function getFormatter()
    {
        $formatter = parent::getFormatter();
        $this->slackRecord->setFormatter($formatter);

        return $formatter;
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions