jc-it/yii2-monolog-slack-handler

A Yii2 implementation of a Slack Monolog handler with more context and formatting.

v2.0.1 2024-12-16 08:54 UTC

This package is auto-updated.

Last update: 2024-12-16 08:54:32 UTC


README

codecov Continous integration Packagist Total Downloads Packagist Monthly Downloads GitHub tag (latest by date) Packagist Version

This extension provides a package that implements some traits and behaviors to work with model attribute translations.

$ composer require jc-it/yii2-monolog-slack-handler

or add

"jc-it/yii2-monolog-slack-handler": "^<latest version>"

to the require section of your composer.json file.

Configuration

For basic configuration see https://github.com/samdark/yii2-psr-log-target.

$logger = new Logger('slack-logger');
$handler = new \JCIT\components\log\SlackErrorWebhookHandler(
    webhookUrl: '<slackErrorWebhookHandler>',
    channel: '<slackChannel>',
    username: '<displayUsername>',
    level: \Monolog\Logger::WARNING,
);
$logger->pushHandler($handler);

TODO

  • Fix PHPStan, re-add to captainhook.json
    • {
          "action": "vendor/bin/phpstan",
          "options": [],
          "conditions": []
      },
      
  • Add tests

Credits

License

The MIT License (MIT). Please see LICENSE for more information.