Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/worker/src/Monolog/Handler
File: AbstractHandler.php
<?php
[0] Fix | Delete
[1] Fix | Delete
/*
[2] Fix | Delete
* This file is part of the Monolog package.
[3] Fix | Delete
*
[4] Fix | Delete
* (c) Jordi Boggiano <j.boggiano@seld.be>
[5] Fix | Delete
*
[6] Fix | Delete
* For the full copyright and license information, please view the LICENSE
[7] Fix | Delete
* file that was distributed with this source code.
[8] Fix | Delete
*/
[9] Fix | Delete
[10] Fix | Delete
/**
[11] Fix | Delete
* Base Handler class providing the Handler structure
[12] Fix | Delete
*
[13] Fix | Delete
* @author Jordi Boggiano <j.boggiano@seld.be>
[14] Fix | Delete
*/
[15] Fix | Delete
abstract class Monolog_Handler_AbstractHandler implements Monolog_Handler_HandlerInterface
[16] Fix | Delete
{
[17] Fix | Delete
protected $level = Monolog_Logger::DEBUG;
[18] Fix | Delete
protected $bubble = true;
[19] Fix | Delete
[20] Fix | Delete
/**
[21] Fix | Delete
* @var Monolog_Formatter_FormatterInterface
[22] Fix | Delete
*/
[23] Fix | Delete
protected $formatter;
[24] Fix | Delete
protected $processors = array();
[25] Fix | Delete
[26] Fix | Delete
/**
[27] Fix | Delete
* @param integer $level The minimum logging level at which this handler will be triggered
[28] Fix | Delete
* @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
[29] Fix | Delete
*/
[30] Fix | Delete
public function __construct($level = Monolog_Logger::DEBUG, $bubble = true)
[31] Fix | Delete
{
[32] Fix | Delete
$this->level = $level;
[33] Fix | Delete
$this->bubble = $bubble;
[34] Fix | Delete
}
[35] Fix | Delete
[36] Fix | Delete
/**
[37] Fix | Delete
* {@inheritdoc}
[38] Fix | Delete
*/
[39] Fix | Delete
public function isHandling(array $record)
[40] Fix | Delete
{
[41] Fix | Delete
return $record['level'] >= $this->level;
[42] Fix | Delete
}
[43] Fix | Delete
[44] Fix | Delete
/**
[45] Fix | Delete
* {@inheritdoc}
[46] Fix | Delete
*/
[47] Fix | Delete
public function handleBatch(array $records)
[48] Fix | Delete
{
[49] Fix | Delete
foreach ($records as $record) {
[50] Fix | Delete
$this->handle($record);
[51] Fix | Delete
}
[52] Fix | Delete
}
[53] Fix | Delete
[54] Fix | Delete
/**
[55] Fix | Delete
* Closes the handler.
[56] Fix | Delete
*
[57] Fix | Delete
* This will be called automatically when the object is destroyed
[58] Fix | Delete
*/
[59] Fix | Delete
public function close()
[60] Fix | Delete
{
[61] Fix | Delete
}
[62] Fix | Delete
[63] Fix | Delete
/**
[64] Fix | Delete
* {@inheritdoc}
[65] Fix | Delete
*/
[66] Fix | Delete
public function pushProcessor($callback)
[67] Fix | Delete
{
[68] Fix | Delete
if (!is_callable($callback)) {
[69] Fix | Delete
throw new InvalidArgumentException('Processors must be valid callables (callback or object with an __invoke method), '.var_export($callback, true).' given');
[70] Fix | Delete
}
[71] Fix | Delete
array_unshift($this->processors, $callback);
[72] Fix | Delete
[73] Fix | Delete
return $this;
[74] Fix | Delete
}
[75] Fix | Delete
[76] Fix | Delete
/**
[77] Fix | Delete
* {@inheritdoc}
[78] Fix | Delete
*/
[79] Fix | Delete
public function popProcessor()
[80] Fix | Delete
{
[81] Fix | Delete
if (!$this->processors) {
[82] Fix | Delete
throw new LogicException('You tried to pop from an empty processor stack.');
[83] Fix | Delete
}
[84] Fix | Delete
[85] Fix | Delete
return array_shift($this->processors);
[86] Fix | Delete
}
[87] Fix | Delete
[88] Fix | Delete
/**
[89] Fix | Delete
* {@inheritdoc}
[90] Fix | Delete
*/
[91] Fix | Delete
public function setFormatter(Monolog_Formatter_FormatterInterface $formatter)
[92] Fix | Delete
{
[93] Fix | Delete
$this->formatter = $formatter;
[94] Fix | Delete
[95] Fix | Delete
return $this;
[96] Fix | Delete
}
[97] Fix | Delete
[98] Fix | Delete
/**
[99] Fix | Delete
* {@inheritdoc}
[100] Fix | Delete
*/
[101] Fix | Delete
public function getFormatter()
[102] Fix | Delete
{
[103] Fix | Delete
if (!$this->formatter) {
[104] Fix | Delete
$this->formatter = $this->getDefaultFormatter();
[105] Fix | Delete
}
[106] Fix | Delete
[107] Fix | Delete
return $this->formatter;
[108] Fix | Delete
}
[109] Fix | Delete
[110] Fix | Delete
/**
[111] Fix | Delete
* Sets minimum logging level at which this handler will be triggered.
[112] Fix | Delete
*
[113] Fix | Delete
* @param integer $level
[114] Fix | Delete
*
[115] Fix | Delete
* @return self
[116] Fix | Delete
*/
[117] Fix | Delete
public function setLevel($level)
[118] Fix | Delete
{
[119] Fix | Delete
$this->level = $level;
[120] Fix | Delete
[121] Fix | Delete
return $this;
[122] Fix | Delete
}
[123] Fix | Delete
[124] Fix | Delete
/**
[125] Fix | Delete
* Gets minimum logging level at which this handler will be triggered.
[126] Fix | Delete
*
[127] Fix | Delete
* @return integer
[128] Fix | Delete
*/
[129] Fix | Delete
public function getLevel()
[130] Fix | Delete
{
[131] Fix | Delete
return $this->level;
[132] Fix | Delete
}
[133] Fix | Delete
[134] Fix | Delete
/**
[135] Fix | Delete
* Sets the bubbling behavior.
[136] Fix | Delete
*
[137] Fix | Delete
* @param Boolean $bubble true means that this handler allows bubbling.
[138] Fix | Delete
* false means that bubbling is not permitted.
[139] Fix | Delete
*
[140] Fix | Delete
* @return self
[141] Fix | Delete
*/
[142] Fix | Delete
public function setBubble($bubble)
[143] Fix | Delete
{
[144] Fix | Delete
$this->bubble = $bubble;
[145] Fix | Delete
[146] Fix | Delete
return $this;
[147] Fix | Delete
}
[148] Fix | Delete
[149] Fix | Delete
/**
[150] Fix | Delete
* Gets the bubbling behavior.
[151] Fix | Delete
*
[152] Fix | Delete
* @return Boolean true means that this handler allows bubbling.
[153] Fix | Delete
* false means that bubbling is not permitted.
[154] Fix | Delete
*/
[155] Fix | Delete
public function getBubble()
[156] Fix | Delete
{
[157] Fix | Delete
return $this->bubble;
[158] Fix | Delete
}
[159] Fix | Delete
[160] Fix | Delete
public function __destruct()
[161] Fix | Delete
{
[162] Fix | Delete
try {
[163] Fix | Delete
$this->close();
[164] Fix | Delete
} catch (Exception $e) {
[165] Fix | Delete
// do nothing
[166] Fix | Delete
}
[167] Fix | Delete
}
[168] Fix | Delete
[169] Fix | Delete
/**
[170] Fix | Delete
* Gets the default formatter.
[171] Fix | Delete
*
[172] Fix | Delete
* @return Monolog_Formatter_FormatterInterface
[173] Fix | Delete
*/
[174] Fix | Delete
protected function getDefaultFormatter()
[175] Fix | Delete
{
[176] Fix | Delete
return new Monolog_Formatter_LineFormatter();
[177] Fix | Delete
}
[178] Fix | Delete
}
[179] Fix | Delete
[180] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function