Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/worker/src/Monolog/Handler
File: TestHandler.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
* Used for testing purposes.
[12] Fix | Delete
*
[13] Fix | Delete
* It records all records and gives you access to them for verification.
[14] Fix | Delete
*
[15] Fix | Delete
* @author Jordi Boggiano <j.boggiano@seld.be>
[16] Fix | Delete
*/
[17] Fix | Delete
class Monolog_Handler_TestHandler extends Monolog_Handler_AbstractProcessingHandler
[18] Fix | Delete
{
[19] Fix | Delete
protected $records = array();
[20] Fix | Delete
protected $recordsByLevel = array();
[21] Fix | Delete
[22] Fix | Delete
public function getRecords()
[23] Fix | Delete
{
[24] Fix | Delete
return $this->records;
[25] Fix | Delete
}
[26] Fix | Delete
[27] Fix | Delete
public function hasEmergency($record)
[28] Fix | Delete
{
[29] Fix | Delete
return $this->hasRecord($record, Monolog_Logger::EMERGENCY);
[30] Fix | Delete
}
[31] Fix | Delete
[32] Fix | Delete
public function hasAlert($record)
[33] Fix | Delete
{
[34] Fix | Delete
return $this->hasRecord($record, Monolog_Logger::ALERT);
[35] Fix | Delete
}
[36] Fix | Delete
[37] Fix | Delete
public function hasCritical($record)
[38] Fix | Delete
{
[39] Fix | Delete
return $this->hasRecord($record, Monolog_Logger::CRITICAL);
[40] Fix | Delete
}
[41] Fix | Delete
[42] Fix | Delete
public function hasError($record)
[43] Fix | Delete
{
[44] Fix | Delete
return $this->hasRecord($record, Monolog_Logger::ERROR);
[45] Fix | Delete
}
[46] Fix | Delete
[47] Fix | Delete
public function hasWarning($record)
[48] Fix | Delete
{
[49] Fix | Delete
return $this->hasRecord($record, Monolog_Logger::WARNING);
[50] Fix | Delete
}
[51] Fix | Delete
[52] Fix | Delete
public function hasNotice($record)
[53] Fix | Delete
{
[54] Fix | Delete
return $this->hasRecord($record, Monolog_Logger::NOTICE);
[55] Fix | Delete
}
[56] Fix | Delete
[57] Fix | Delete
public function hasInfo($record)
[58] Fix | Delete
{
[59] Fix | Delete
return $this->hasRecord($record, Monolog_Logger::INFO);
[60] Fix | Delete
}
[61] Fix | Delete
[62] Fix | Delete
public function hasDebug($record)
[63] Fix | Delete
{
[64] Fix | Delete
return $this->hasRecord($record, Monolog_Logger::DEBUG);
[65] Fix | Delete
}
[66] Fix | Delete
[67] Fix | Delete
public function hasEmergencyRecords()
[68] Fix | Delete
{
[69] Fix | Delete
return isset($this->recordsByLevel[Monolog_Logger::EMERGENCY]);
[70] Fix | Delete
}
[71] Fix | Delete
[72] Fix | Delete
public function hasAlertRecords()
[73] Fix | Delete
{
[74] Fix | Delete
return isset($this->recordsByLevel[Monolog_Logger::ALERT]);
[75] Fix | Delete
}
[76] Fix | Delete
[77] Fix | Delete
public function hasCriticalRecords()
[78] Fix | Delete
{
[79] Fix | Delete
return isset($this->recordsByLevel[Monolog_Logger::CRITICAL]);
[80] Fix | Delete
}
[81] Fix | Delete
[82] Fix | Delete
public function hasErrorRecords()
[83] Fix | Delete
{
[84] Fix | Delete
return isset($this->recordsByLevel[Monolog_Logger::ERROR]);
[85] Fix | Delete
}
[86] Fix | Delete
[87] Fix | Delete
public function hasWarningRecords()
[88] Fix | Delete
{
[89] Fix | Delete
return isset($this->recordsByLevel[Monolog_Logger::WARNING]);
[90] Fix | Delete
}
[91] Fix | Delete
[92] Fix | Delete
public function hasNoticeRecords()
[93] Fix | Delete
{
[94] Fix | Delete
return isset($this->recordsByLevel[Monolog_Logger::NOTICE]);
[95] Fix | Delete
}
[96] Fix | Delete
[97] Fix | Delete
public function hasInfoRecords()
[98] Fix | Delete
{
[99] Fix | Delete
return isset($this->recordsByLevel[Monolog_Logger::INFO]);
[100] Fix | Delete
}
[101] Fix | Delete
[102] Fix | Delete
public function hasDebugRecords()
[103] Fix | Delete
{
[104] Fix | Delete
return isset($this->recordsByLevel[Monolog_Logger::DEBUG]);
[105] Fix | Delete
}
[106] Fix | Delete
[107] Fix | Delete
protected function hasRecord($record, $level)
[108] Fix | Delete
{
[109] Fix | Delete
if (!isset($this->recordsByLevel[$level])) {
[110] Fix | Delete
return false;
[111] Fix | Delete
}
[112] Fix | Delete
[113] Fix | Delete
if (is_array($record)) {
[114] Fix | Delete
$record = $record['message'];
[115] Fix | Delete
}
[116] Fix | Delete
[117] Fix | Delete
foreach ($this->recordsByLevel[$level] as $rec) {
[118] Fix | Delete
if ($rec['message'] === $record) {
[119] Fix | Delete
return true;
[120] Fix | Delete
}
[121] Fix | Delete
}
[122] Fix | Delete
[123] Fix | Delete
return false;
[124] Fix | Delete
}
[125] Fix | Delete
[126] Fix | Delete
/**
[127] Fix | Delete
* {@inheritdoc}
[128] Fix | Delete
*/
[129] Fix | Delete
protected function write(array $record)
[130] Fix | Delete
{
[131] Fix | Delete
$this->recordsByLevel[$record['level']][] = $record;
[132] Fix | Delete
$this->records[] = $record;
[133] Fix | Delete
}
[134] Fix | Delete
}
[135] Fix | Delete
[136] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function