/usr/share/php/Analog/Handler/Threshold.php is in php-analog 1.0.7-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | <?php
namespace Analog\Handler;
/**
* Only writes log messages above a certain threshold
*
*
* Usage:
*
* Analog::handler (Analog\Handler\Threshold::init (
* Analog\Handler\File::init ($file),
* Analog::ERROR
* ));
*
* // Only message three will be logged
* Analog::log ('Message one', Analog::DEBUG);
* Analog::log ('Message two', Analog::WARNING);
* Analog::log ('Message three', Analog::URGENT);
*
* Note: Uses Analog::$format to format the messages as they're appended
* to the buffer.
*/
class Threshold {
/**
* This contains the handler to send to on close.
*/
public static $handler;
/**
* Accepts another handler function to be used on close().
* $until_level defaults to ERROR.
*/
public static function init ($handler, $until_level = 3) {
self::$handler = $handler;
return function ($info) use ($until_level) {
if ($info['level'] <= $until_level) {
$handler = Threshold::$handler;
$handler ($info);
}
};
}
}
|