Sends notifications through Slack API

CloneableInstantiable
ExtendsMonolog\Handler\SocketHandler
Monolog\Handler\AbstractProcessingHandler
Monolog\Handler\AbstractHandler
Monolog\Handler\Handler
ImplementsMonolog\Handler\FormattableHandlerInterface
Monolog\Handler\HandlerInterface
Monolog\Handler\ProcessableHandlerInterface
Monolog\ResettableInterface
Methods
public __construct(string $token, string $channel, ?string $username = NULL, bool $useAttachment = true, ?string $iconEmoji = NULL, $level = 500, bool $bubble = true, bool $useShortAttachment = false, bool $includeContextAndExtra = false, array $excludeFields = [])
 


public Monolog\Handler\Handler::__destruct()
public Monolog\Handler\Handler::__sleep()
public Monolog\Handler\SocketHandler::close() : void
 
We will not close a PersistentSocket instance so it can be reused in other requests.

public Monolog\Handler\SocketHandler::closeSocket() : void
 
Close socket, if open

public excludeFields(array $excludeFields) : self
public Monolog\Handler\AbstractHandler::getBubble() : bool
 
Gets the bubbling behavior.

  • return bool true means that this handler allows bubbling. false means that bubbling is not permitted.
public Monolog\Handler\SocketHandler::getChunkSize() : int
 
Get current chunk size

public Monolog\Handler\SocketHandler::getConnectionString() : string
 
Get current connection string

public Monolog\Handler\SocketHandler::getConnectionTimeout() : float
 
Get current connection timeout setting

public getFormatter() : Monolog\Formatter\FormatterInterface
public Monolog\Handler\AbstractHandler::getLevel() : int
 
Gets minimum logging level at which this handler will be triggered.

  • return int
public getSlackRecord() : Monolog\Handler\Slack\SlackRecord
public Monolog\Handler\SocketHandler::getTimeout() : float
 
Get current in-transfer timeout

public getToken() : string
public Monolog\Handler\SocketHandler::getWritingTimeout() : float
 
Get current local writing timeout

  • return float
public Monolog\Handler\AbstractProcessingHandler::handle(array $record) : bool
 
{@inheritdoc}

public Monolog\Handler\Handler::handleBatch(array $records) : void
 
{@inheritdoc}

public includeContextAndExtra(bool $includeContextAndExtra) : self
public Monolog\Handler\SocketHandler::isConnected() : bool
 
Check to see if the socket is currently available.

UDP might appear to be connected but might fail when writing. See http://php.net/fsockopen for details.

public Monolog\Handler\AbstractHandler::isHandling(array $record) : bool
 
{@inheritdoc}

public Monolog\Handler\SocketHandler::isPersistent() : bool
 
Get persistent setting

public Monolog\Handler\AbstractProcessingHandler::popProcessor() : callable
 
{@inheritdoc}

public Monolog\Handler\AbstractProcessingHandler::pushProcessor(callable $callback) : Monolog\Handler\HandlerInterface
 
{@inheritdoc}

  • suppress PhanTypeMismatchReturn
public Monolog\Handler\AbstractProcessingHandler::reset()
public Monolog\Handler\AbstractHandler::setBubble(bool $bubble) : self
 
Sets the bubbling behavior.

  • return self
public setChannel(string $channel) : self
 
Channel used by the bot when posting

public Monolog\Handler\SocketHandler::setChunkSize(int $bytes) : self
 
Set chunk size. Only has effect during connection in the writing cycle.

public Monolog\Handler\SocketHandler::setConnectionTimeout(float $seconds) : self
 
Set connection timeout. Only has effect before we connect.

  • see http://php.net/manual/en/function.fsockopen.php
public setFormatter(Monolog\Formatter\FormatterInterface $formatter) : Monolog\Handler\HandlerInterface
public setIconEmoji(string $iconEmoji) : self
public Monolog\Handler\AbstractHandler::setLevel( $level) : self
 
Sets minimum logging level at which this handler will be triggered.

  • return self
public Monolog\Handler\SocketHandler::setPersistent(bool $persistent) : self
 
Set socket connection to be persistent. It only has effect before the connection is initiated.

public Monolog\Handler\SocketHandler::setTimeout(float $seconds) : self
 
Set write timeout. Only has effect before we connect.

  • see http://php.net/manual/en/function.stream-set-timeout.php
public setUsername(string $username) : self
 
Username used by the bot when posting

public Monolog\Handler\SocketHandler::setWritingTimeout(float $seconds) : self
 
Set writing timeout. Only has effect during connection in the writing cycle.

    public useAttachment(bool $useAttachment) : self
    public useShortAttachment(bool $useShortAttachment) : self
    Properties
    protected Monolog\Handler\AbstractHandler::$bubble
    protected Monolog\Handler\AbstractProcessingHandler::$formatter
     


    • var FormatterInterface
    protected Monolog\Handler\AbstractHandler::$level
    protected Monolog\Handler\AbstractProcessingHandler::$processors
     


    • var callable[]
    Methods
    protected finalizeWrite() : void
     
    Finalizes the request by reading some bytes and then closing the socket

    If we do not read some but close the socket too early, slack sometimes
    drops the request entirely.

    protected Monolog\Handler\SocketHandler::fsockopen()
     
    Wrapper to allow mocking

    protected Monolog\Handler\SocketHandler::fwrite( $data)
     
    Wrapper to allow mocking

    protected generateDataStream(array $record) : string
     
    {@inheritdoc}

    protected Monolog\Handler\AbstractProcessingHandler::getDefaultFormatter() : Monolog\Formatter\FormatterInterface
     
    Gets the default formatter.

    Overwrite this if the LineFormatter is not a good default for your handler.

    protected Monolog\Handler\SocketHandler::getResource()
     


    • return resource|null
    protected Monolog\Handler\SocketHandler::pfsockopen()
     
    Wrapper to allow mocking

    protected prepareContentData(array $record) : array
    protected Monolog\Handler\AbstractProcessingHandler::processRecord(array $record) : array
     
    Processes a record.

    protected Monolog\Handler\AbstractProcessingHandler::resetProcessors() : void
    protected Monolog\Handler\SocketHandler::streamGetMetadata()
     
    Wrapper to allow mocking

    protected Monolog\Handler\SocketHandler::streamSetChunkSize()
     
    Wrapper to allow mocking

    • see http://php.net/manual/en/function.stream-set-chunk-size.php
    protected Monolog\Handler\SocketHandler::streamSetTimeout()
     
    Wrapper to allow mocking

    • see http://php.net/manual/en/function.stream-set-timeout.php
    protected write(array $record) : void
     
    {@inheritdoc}

    Properties
    private $slackRecord
     
    Instance of the SlackRecord util class preparing data for Slack API.

    • var SlackRecord
    private $token
     
    Slack API token

    • var string
    Methods
    private buildContent(array $record) : string
     
    Builds the body of API call

    private buildHeader(string $content) : string
     
    Builds the header of the API Call

    private Monolog\Handler\SocketHandler::connect() : void
    private Monolog\Handler\SocketHandler::connectIfNotConnected()
    private Monolog\Handler\SocketHandler::createSocketResource() : void
    private Monolog\Handler\SocketHandler::setSocketTimeout() : void
    private Monolog\Handler\SocketHandler::setStreamChunkSize() : void
    private Monolog\Handler\SocketHandler::validateTimeout( $value)
    private Monolog\Handler\SocketHandler::writeToSocket(string $data) : void
    private Monolog\Handler\SocketHandler::writingIsTimedOut(int $sent) : bool
    © 2020 Bruce Wells
    Search Namespaces \ Classes
    ConfigurationNumbers (0-9.) only