本文整理汇总了PHP中common_Logger::singleton方法的典型用法代码示例。如果您正苦于以下问题:PHP common_Logger::singleton方法的具体用法?PHP common_Logger::singleton怎么用?PHP common_Logger::singleton使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common_Logger
的用法示例。
在下文中一共展示了common_Logger::singleton方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getLogger
/**
*
* @return \Psr\Log\LoggerInterface
*/
public function getLogger()
{
if (is_null($this->logger)) {
$this->logger = new \common_log_Logger2Psr(\common_Logger::singleton());
}
return $this->logger;
}
示例2: analyseLogPerformance
public function analyseLogPerformance()
{
common_Logger::singleton()->enable();
$start = microtime(true);
for ($i = 0; $i < self::RUNS; $i++) {
// nothing
}
$emptyTime = microtime(true) - $start;
echo "Idle run: " . $emptyTime . "<br />";
$start = microtime(true);
for ($i = 0; $i < self::RUNS; $i++) {
common_Logger::t('a trace test message');
}
$traceTime = microtime(true) - $start;
echo "Trace run: " . $traceTime . "<br />";
$start = microtime(true);
for ($i = 0; $i < self::RUNS; $i++) {
common_Logger::i('a info test message');
}
$infoTime = microtime(true) - $start;
echo "Info run: " . $infoTime . "<br />";
common_Logger::singleton()->restore();
common_Logger::singleton()->disable();
$start = microtime(true);
for ($i = 0; $i < self::RUNS; $i++) {
common_Logger::i('a disabled test message');
}
$disabledTime = microtime(true) - $start;
echo "Disabled run: " . $disabledTime . "<br />";
common_Logger::singleton()->restore();
$start = microtime(true);
sleep(1);
$testwait = microtime(true) - $start;
echo "Wait: " . $testwait . "<br />";
echo "ok";
}
示例3: __construct
public function __construct($message = null, $code = 0, Exception $previous = null)
{
parent::__construct($message, $code);
common_Logger::singleton()->handleException($this);
}
示例4: registerErrorhandler
/**
* register a custom Errorhandler
*/
protected function registerErrorhandler()
{
// register the logger as erorhandler
common_Logger::singleton()->register();
}
示例5: __construct
public function __construct($serviceKey, $message = '')
{
parent::__construct('Service "' . $serviceKey . '" not found' . (empty($message) ? '' : ': ' . $message));
$this->serviceKey = $serviceKey;
\common_Logger::singleton()->handleException($this);
}