jspalink / apix-log-pushover
A Pushover logger for APIx Log
Requires
- php: >=5.3
- apix/log: ^1.2
- sqmk/pushy: ^1.4
Requires (Dev)
- phpunit/phpunit: 4.8.*
Provides
- psr/log-implementation: 1.0.0
This package is not auto-updated.
Last update: 2024-12-08 05:29:29 UTC
README
#Pushover logger for Apix Log
An extension for the Apix/Log PSR-3 logger that sends log messages via Pushover.net via the 3rd party Pushy API implementation.
Apix Log was written by Franck Cassedanne (@frqnck). This extension is by Jonathan Spalink (@jspalink) and is released under the BSD-3 license.
##Installation
You can install the Pushover logger using composer:
{ "require": { "jspalink/apix-log-pushover": "dev-master" } }
See composer and packagist for more information.
##Usage
Create an Apix Pushover Log instance, providing pre-configured Pushy Client and User instances to the constructor. The new Log instance will be used for all subsequent messages sent through to Pushover.
By default, the logger will send a push notification for each log message received.
Especially given Pushover's monthly limitations and
"Being Friendly" clauses, I recommend calling
$logger->setDeferred(true)
to aggregate log messages and send them in one message
when the destructor is called.
There is also a character length limitation for Pushover of 1024 characters. The Pushover Logger will truncate at 1024 characters and will not indicate that the message would have been longer. This means that you may possibly lose valuable logging information if you aggregate too much at once.
##Example
// Create Pushy Client and User instances $pushy_client = new Pushy\Client('APPLICATION KEY'); $pushy_user = new Pushy\User('USER/GROUP ID'); $logger = new Apix\Logger\Pushover($pushy_client, $pushy_user); $logger->setDeferred(true); $logger->info('Info about something'); $logger->error('An error occurred');