本文整理汇总了PHP中Logger::getLevelName方法的典型用法代码示例。如果您正苦于以下问题:PHP Logger::getLevelName方法的具体用法?PHP Logger::getLevelName怎么用?PHP Logger::getLevelName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Logger
的用法示例。
在下文中一共展示了Logger::getLevelName方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addRemitFromPhone
public function addRemitFromPhone($request, $response)
{/*{{{*/
$bankPhoneNo = $request->bankPhoneNo;
$phoneNo = $request->phoneNo;
//if($phoneNo != 13439853264 || $phoneNo != 13501126300)
//{
// echo "错误的手机号";
// exit;
//}
$remitTime = $request->remitTime/1000;
$remitTime = xdatetime::valueOfTime($remitTime);
$message = mb_convert_encoding($request->message, "gbk", "utf-8");
//$message = $request->message;
$device = $request->device;
$logger = new Logger('sms_remit', BeanFinder::get('configs')->remitLogPath, Logger::getLevelName(Logger::INFO));
$logger->addInfo('device:'.$device.' bankPhoneNo:'.$bankPhoneNo.' phoneNo:'.$phoneNo.' message:'.$message);
$recorder = DAL::get()->find_by_name('user', 'jm130');
$res = AccountClient::getInstance()->createRemitAuto($recorder, $bankPhoneNo, $phoneNo, $remitTime, $message);
if ($res['errorcode'] != 0 && false == empty($message))
{
$msg = $device." errorcode:".$res['errorcode']." message:".$message;
//给whd & yyp & wk
SMSClient::getInstance()->sendSMS(array(18612032258, 13691343423, 13720084864), $msg);
}
$res = json_encode($res);
echo $res;
return parent::DIRECT_OUTPUT;
}/*}}}*/
示例2: formatMessage
/**
* @inheritdoc
*/
public function formatMessage($message)
{
list($text, $level, $category, $timestamp) = $message;
$level = Logger::getLevelName($level);
if (!is_string($text)) {
// exceptions may not be serializable if in the call stack somewhere is a Closure
if ($text instanceof \Exception) {
$text = (string) $text;
} else {
$text = VarDumper::export($text);
}
}
$prefix = $this->getMessagePrefix($message);
return "{$prefix}[{$level}][{$category}] {$text}";
}
示例3: getLevelName
}
public function getLevelName($level)
{
return $this->logLevels[$level];
}
}
// testing
if (isset($_SERVER["argv"][1]) && $_SERVER["argv"][1] == "__main__") {
$logger = new Logger();
for ($i = 0; $i < 6; $i++) {
$logger->setLevel($i);
error_log("############## Level now: " . $i);
$logger->debug("");
$logger->info("");
$logger->notice("");
$logger->warn("");
$logger->error("");
$logger->critical("");
}
error_log("############# With Level Names");
for ($i = 0; $i < 6; $i++) {
$logger->setLevel($logger->getLevelName($i));
error_log("############## Level now: " . $logger->getLevelName($i));
$logger->debug("");
$logger->info("", __FILE__, __LINE__);
$logger->notice("");
$logger->warn("");
$logger->error("");
$logger->critical("");
}
}
示例4: close
public function close($context = array())
{
$method = 'add' . ucfirst(strtolower(Logger::getLevelName($this->level)));
$arguments = array(implode("\n", $this->messages), $context);
return call_user_func_array(array($this->logger, $method), $arguments);
}
示例5: getRecord
/**
* @return array Record
*/
protected function getRecord($level = Logger::WARNING, $message = 'test', $context = array())
{
return array('message' => $message, 'context' => $context, 'level' => $level, 'level_name' => Logger::getLevelName($level), 'channel' => 'test', 'datetime' => \DateTime::createFromFormat('U.u', sprintf('%.6F', microtime(true))), 'extra' => array());
}
示例6: testGetLevelName
/**
* @param $level
* @param $expected
* @dataProvider levelProvider
*/
public function testGetLevelName($level, $expected)
{
$this->assertEquals($expected, Logger::getLevelName($level));
}
示例7: getRecord
/**
* @return array Record
*/
protected function getRecord($level = Logger::WARNING, $message = 'test')
{
return array('message' => $message, 'context' => array(), 'level' => $level, 'level_name' => Logger::getLevelName($level), 'channel' => 'test', 'datetime' => new \DateTime(), 'extra' => array());
}
示例8: formatMessage
/**
* Formats a log message for display as a string.
* @param string $message The log message to be formatted.
* @return string The formatted message.
*/
public function formatMessage($message) : string
{
list($text, $level, $category) = $message;
return strtr('[{level}@{category}] {text}', ['{category}' => $category, '{level}' => Logger::getLevelName($level), '{text}' => is_string($text) ? $text : VarDumper::export($text)]);
}