PluginProbe
DecaLog / 4.4.0
DecaLog v4.4.0
3.0.2 3.1.0 3.10.0 3.2.0 3.3.0 3.4.0 3.4.1 3.5.0 3.5.1 3.6.0 3.6.1 3.6.2 3.6.3 3.7.0 3.7.1 3.8.0 3.9.0 3.9.1 4.0.0 4.1.0 4.2.0 4.3.0 4.3.1 4.4.0 4.5.0 All 75 releases
decalog / includes / handlers / class-pshhandler.php

class-pshhandler.php in DecaLog 4.4.0, at includes/handlers/class-pshhandler.php

48 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Pushover handler for Monolog
4 *
5 * Handles all features of Pushover handler for Monolog.
6 *
7 * @package Handlers
8 * @author Pierre Lannoy <https://pierre.lannoy.fr/>.
9 * @since 1.3.0
10 */
11
12 namespace Decalog\Handler;
13
14 use DLMonolog\Logger;
15 use DLMonolog\Handler\PushoverHandler;
16
17 /**
18 * Define the Monolog Pushover handler.
19 *
20 * Handles all features of Pushover handler for Monolog.
21 *
22 * @package Handlers
23 * @author Pierre Lannoy <https://pierre.lannoy.fr/>.
24 * @since 1.3.0
25 */
26 class PshHandler extends PushoverHandler {
27
28 /**
29 * Initialize the class and set its properties.
30 *
31 * @param string $token Pushover api token.
32 * @param string|array $users Pushover user id or array of ids the message will be sent to.
33 * @param string|null $title Optional. Title sent to the Pushover API.
34 * @param integer $timeout Optional. The socket timeout.
35 * @param int|string $level The minimum logging level at which this handler will be triggered.
36 * @since 1.3.0
37 */
38 public function __construct( $token, $users, $title = null, $timeout = 1000, $level = Logger::CRITICAL ) {
39 $new_timeout = (int) round($timeout / 1000);
40 $old_timeout = ini_get( 'default_socket_timeout' );
41 // phpcs:ignore
42 ini_set( 'default_socket_timeout', (string) $new_timeout );
43 parent::__construct( $token, $users, $title, $level, true, true );
44 // phpcs:ignore
45 ini_set( 'default_socket_timeout', (string) $old_timeout );
46 }
47 }
48