本文整理汇总了PHP中LoggerLoggingEvent::getMessage方法的典型用法代码示例。如果您正苦于以下问题:PHP LoggerLoggingEvent::getMessage方法的具体用法?PHP LoggerLoggingEvent::getMessage怎么用?PHP LoggerLoggingEvent::getMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LoggerLoggingEvent
的用法示例。
在下文中一共展示了LoggerLoggingEvent::getMessage方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: append
public function append(LoggerLoggingEvent $event)
{
$log = new StdClass();
$log->time = $event->getTimeStamp();
$log->level = $event->getLevel()->toString();
$log->msg = $event->getMessage();
$log->logger = $event->getLoggerName();
$this->logBuffer[] = $log;
$this->emitter->emit('event', array($log));
if (count($this->logBuffer) > $this->logLimit) {
array_shift($this->logBuffer);
}
}
示例2: append
public function append(LoggerLoggingEvent $event)
{
$msg = $event->getMessage();
// Skip formatting for objects and arrays which are handled by FirePHP.
if (!is_array($msg) && !is_object($msg)) {
$msg = $this->getLayout()->format($event);
}
switch ($event->getLevel()->toInt()) {
case LoggerLevel::TRACE:
case LoggerLevel::DEBUG:
$this->console->log($msg);
break;
case LoggerLevel::INFO:
$this->console->info($msg);
break;
case LoggerLevel::WARN:
$this->console->warn($msg);
break;
case LoggerLevel::ERROR:
case LoggerLevel::FATAL:
$this->console->error($msg);
break;
}
}
示例3: format
/**
* Converts the logging event into an array which can be logged to mongodb.
*
* @param LoggerLoggingEvent $event
* @return array The array representation of the logging event.
*/
protected function format(LoggerLoggingEvent $event)
{
$timestampSec = (int) $event->getTimestamp();
$timestampUsec = (int) (($event->getTimestamp() - $timestampSec) * 1000000);
$document = array('timestamp' => new MongoDate($timestampSec, $timestampUsec), 'level' => $event->getLevel()->toString(), 'thread' => (int) $event->getThreadName(), 'message' => $event->getMessage(), 'loggerName' => $event->getLoggerName());
$locationInfo = $event->getLocationInformation();
if ($locationInfo != null) {
$document['fileName'] = $locationInfo->getFileName();
$document['method'] = $locationInfo->getMethodName();
$document['lineNumber'] = $locationInfo->getLineNumber() == 'NA' ? 'NA' : (int) $locationInfo->getLineNumber();
$document['className'] = $locationInfo->getClassName();
}
$throwableInfo = $event->getThrowableInformation();
if ($throwableInfo != null) {
$document['exception'] = $this->formatThrowable($throwableInfo->getThrowable());
}
return $document;
}
示例4: getFullMessage
protected function getFullMessage(LoggerLoggingEvent $event)
{
if (strpos($event->getMessage(), $this->getShortMessageEndTag()) !== false) {
list(, $fullMessage) = explode($this->getShortMessageEndTag(), $event->getMessage());
return $fullMessage;
}
return $event->getMessage();
}
示例5: append
public function append(\LoggerLoggingEvent $event)
{
self::addError(strtolower($event->getLevel()->toString()), $event->getMessage());
}
示例6: doAppend
/**
* @see LoggerAppender::doAppend()
* @param LoggerLoggingEvent $event
*/
function doAppend($event)
{
LoggerLog::debug("LoggerAppenderSkeleton::doAppend() " . $event->getMessage());
if ($this->closed) {
LoggerLog::debug("LoggerAppenderSkeleton::doAppend() Attempted to append to closed appender named [{$this->name}].");
return;
}
if (!$this->isAsSevereAsThreshold($event->getLevel())) {
LoggerLog::debug("LoggerAppenderSkeleton::doAppend() event level is less severe than threshold.");
return;
}
$f = $this->getFirstFilter();
while ($f !== null) {
switch ($f->decide($event)) {
case LOG4PHP_LOGGER_FILTER_DENY:
return;
case LOG4PHP_LOGGER_FILTER_ACCEPT:
return $this->append($event);
case LOG4PHP_LOGGER_FILTER_NEUTRAL:
$f = $f->next;
}
}
$this->append($event);
}