/** * Logs with an arbitrary level. * * @param mixed $level * @param string $message * @param array $context * @return void */ public function log($level, $message, array $context = array()) { if (!isset($context['file'])) { $context['file'] = __FILE__; } if (!isset($context['line'])) { $context['line'] = __LINE__; } if ($level === null) { $level = LogLevel::INFO; } if (Debug::isDebug() === true) { if (Debug::getKindOfReportLog() === 'error_log' || Debug::getKindOfReportLog() === 'all') { error_log($context['file'] . '> (l.' . $context['line'] . ') ' . $message); } if (Debug::getKindOfReportLog() === 'screen' || Debug::getKindOfReportLog() === 'all') { echo '<table width="100%" style="background:orange;border:solid red 15px;"><tr><td style="color:black;padding:10px;font-size:18px;">'; echo $context['file'] . '> (l.' . $context['line'] . ') ' . $message . '<br/>' . "\n"; echo '</td></tr></table>'; } } }
/** * get file content and merge if not exists * * @access private * @param string $sFileToMerge file to get * @param \stdClass $base base * @return \stdClass */ private static function _mergeAndGetConf(string $sFileToMerge, \stdClass $base) : \stdClass { $oConfFiles = json_decode(file_get_contents($sFileToMerge)); if (is_object($oConfFiles)) { list($oConfFiles, $base) = self::_recursiveGet($oConfFiles, $base); return $base; } else { echo "The Json " . $sFileToMerge . " has an error! Please verify!\n"; $oDebug = Debug::getInstance(); $oDebug->error("The Json " . $sFileToMerge . " has an error! Please verify!\n"); new \Exception("The Json " . $sFileToMerge . " has an error! Please verify!\n"); } }
/** * constructor * * @access public */ public function __construct() { $oLogger = Debug::getInstance(); $this->setLogger($oLogger); }
<?php /** * bootstrap of the demo * * @author Judicaël Paquet <*****@*****.**> * @copyright Copyright (c) 2013-2014 PAQUET Judicaël FR Inc. (https://github.com/las93) * @license https://github.com/las93/venus3/blob/master/LICENSE.md Tout droit réservé à PAQUET Judicaël * @version Release: 3.0.0 * @filesource https://github.com/las93/venus3 * @link https://github.com/las93 * @since 3.0 */ declare (strict_types=1); error_reporting(E_ALL); ini_set('display_error', '1'); set_include_path(get_include_path() . PATH_SEPARATOR . str_replace('public', 'bundles', __DIR__)); require 'conf/AutoLoad.php'; \Venus\lib\Debug::activateDebug(); $oRouter = new \Venus\core\Router(); $oRouter->run();
/** * assign a variable for the Benchmark * * @access public * @param string $sName name of point * @return void */ public static function setPointInLog(string $sName = 'default') { $oLogger = Debug::getInstance(); $oLogger->info('BENCHMARK: Time at this point ' . (microtime(true) - self::$_fStart) . ' - ' . $sName); }