/usr/share/php/Analog/Handler/File.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 | <?php
namespace Analog\Handler;
/**
* Append to the specified log file. Does the same thing as the default
* handling.
*
* Usage:
*
* $log_file = 'log.txt';
* Analog::handler (Analog\Handler\File::init ($log_file));
*
* Analog::log ('Log me');
*
* Note: Uses Analog::$format for the appending format.
*/
class File {
public static function init ($file) {
return function ($info, $buffered = false) use ($file) {
$f = fopen ($file, 'a+');
if (! $f) {
throw new \LogicException ('Could not open file for writing');
}
if (! flock ($f, LOCK_EX)) {
throw new \RuntimeException ('Could not lock file');
}
fwrite ($f, ($buffered)
? $info
: vsprintf (\Analog\Analog::$format, $info));
flock ($f, LOCK_UN);
fclose ($f);
};
}
}
|