Handler send logs to Telegram using Telegram Bot API.

How to use:
1) Create telegram bot with https://telegram.me/BotFather
2) Create a telegram channel where logs will be recorded.
3) Add created bot from step 1 to the created channel from step 2.

Use telegram bot API key from step 1 and channel name with '@' prefix from step 2 to create instance of TelegramBotHandler

public __construct(string $apiKey, string $channel, $level = 100, bool $bubble = true)

  • inheritDoc
public Monolog\Handler\Handler::__destruct()
public Monolog\Handler\Handler::__sleep()
public Monolog\Handler\Handler::close() : void

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\AbstractProcessingHandler::getFormatter() : Monolog\Formatter\FormatterInterface

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

  • return int
public Monolog\Handler\AbstractProcessingHandler::handle(array $record) : bool

public Monolog\Handler\Handler::handleBatch(array $records) : void

public Monolog\Handler\AbstractHandler::isHandling(array $record) : bool

public Monolog\Handler\AbstractProcessingHandler::popProcessor() : callable

public Monolog\Handler\AbstractProcessingHandler::pushProcessor(callable $callback) : Monolog\Handler\HandlerInterface

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

  • return self
public Monolog\Handler\AbstractProcessingHandler::setFormatter(Monolog\Formatter\FormatterInterface $formatter) : Monolog\Handler\HandlerInterface

  • suppress PhanTypeMismatchReturn
public Monolog\Handler\AbstractHandler::setLevel( $level) : self
Sets minimum logging level at which this handler will be triggered.

  • return self
protected Monolog\Handler\AbstractHandler::$bubble
protected Monolog\Handler\AbstractProcessingHandler::$formatter

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

  • var callable[]
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\AbstractProcessingHandler::processRecord(array $record) : array
Processes a record.

protected Monolog\Handler\AbstractProcessingHandler::resetProcessors() : void
protected send(string $message) : void
Send request to @link https://api.telegram.org/bot on SendMessage action.

    protected write(array $record) : void

    • inheritDoc
    private Monolog\Handler\TelegramBotHandler::BOT_API = 'https://api.telegram.org/bot'
    private $apiKey
    Telegram bot access token provided by BotFather.

    Create telegram bot with https://telegram.me/BotFather and use access token from it.

    • var string
    private $channel
    Telegram channel name.

    Since to start with '@' symbol as prefix.

    • var string
    © 2020 Bruce Wells
    Search Namespaces \ Classes
    ConfigurationNumbers (0-9.) only