%PDF- %GIF98; %PNG;
Server : ApacheSystem : Linux host.digitalbabaji.in 4.18.0-513.11.1.el8_9.x86_64 #1 SMP Wed Jan 17 02:00:40 EST 2024 x86_64 User : addictionfreeind ( 1003) PHP Version : 7.2.34 Disable Function : exec,passthru,shell_exec,system Directory : /home/addictionfreeind/public_html/vendor/cakephp/debug_kit/src/Log/Engine/ |
Upload File : |
<?php
/**
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
namespace DebugKit\Log\Engine;
use Cake\Log\Engine\BaseLog;
/**
* A CakeLog listener which saves having to munge files or other configured loggers.
*
*/
class DebugKitLog extends BaseLog
{
/**
* logs
*
* @var array
*/
protected $_logs = [];
/**
* Captures log messages in memory
*
* @param string $type The type of message being logged.
* @param string $message The message being logged.
* @param array $context Additional context data
* @return void
*/
public function log($type, $message, array $context = [])
{
if (!isset($this->_logs[$type])) {
$this->_logs[$type] = [];
}
$this->_logs[$type][] = [date('Y-m-d H:i:s'), $this->_format($message)];
}
/**
* Get the logs.
*
* @return array
*/
public function all()
{
return $this->_logs;
}
/**
* Get the number of log entries.
*
* @return int
*/
public function count()
{
return array_reduce($this->_logs, function ($sum, $v) {
return $sum + count($v);
}, 0);
}
/**
* Check if there are no logs.
*
* @return bool
*/
public function noLogs()
{
return empty($this->_logs);
}
}