当前位置: 首页>>代码示例>>PHP>>正文


PHP LoggerLoggingEvent::getLevel方法代码示例

本文整理汇总了PHP中LoggerLoggingEvent::getLevel方法的典型用法代码示例。如果您正苦于以下问题:PHP LoggerLoggingEvent::getLevel方法的具体用法?PHP LoggerLoggingEvent::getLevel怎么用?PHP LoggerLoggingEvent::getLevel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LoggerLoggingEvent的用法示例。


在下文中一共展示了LoggerLoggingEvent::getLevel方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testLevel

 public function testLevel()
 {
     $converter = new LoggerPatternConverterLevel($this->info);
     $actual = $converter->convert($this->event);
     $expected = $this->event->getLevel()->toString();
     self::assertEquals($expected, $actual);
 }
开发者ID:brennantom,项目名称:hackazon,代码行数:7,代码来源:LoggerPatternConverterTest.php

示例2: decide

 /**
  * Return the decision of this filter.
  * 
  * Returns {@link LoggerFilter::NEUTRAL} if the <b><var>LevelToMatch</var></b>
  * option is not set or if there is not match.	Otherwise, if there is a
  * match, then the returned decision is {@link LoggerFilter::ACCEPT} if the
  * <b><var>AcceptOnMatch</var></b> property is set to <i>true</i>. The
  * returned decision is {@link LoggerFilter::DENY} if the
  * <b><var>AcceptOnMatch</var></b> property is set to <i>false</i>.
  *
  * @param LoggerLoggingEvent $event
  * @return integer
  */
 public function decide(LoggerLoggingEvent $event)
 {
     if ($this->levelToMatch === null) {
         return LoggerFilter::NEUTRAL;
     }
     if ($this->levelToMatch->equals($event->getLevel())) {
         return $this->acceptOnMatch ? LoggerFilter::ACCEPT : LoggerFilter::DENY;
     } else {
         return LoggerFilter::NEUTRAL;
     }
 }
开发者ID:dobreapa,项目名称:owasp-esapi-php,代码行数:24,代码来源:LoggerFilterLevelMatch.php

示例3: append

 public function append(LoggerLoggingEvent $event)
 {
     $level = $event->getLevel();
     if ($level->isGreaterOrEqual(LoggerLevel::getLevelError())) {
         trigger_error($this->layout->format($event), E_USER_ERROR);
     } else {
         if ($level->isGreaterOrEqual(LoggerLevel::getLevelWarn())) {
             trigger_error($this->layout->format($event), E_USER_WARNING);
         } else {
             trigger_error($this->layout->format($event), E_USER_NOTICE);
         }
     }
 }
开发者ID:josefd8,项目名称:dashboardWeb,代码行数:13,代码来源:LoggerAppenderPhp.php

示例4: 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);
     }
 }
开发者ID:unkerror,项目名称:Budabot,代码行数:13,代码来源:LoggerAppenderBuffer.php

示例5: convert

 /**
  * @param LoggerLoggingEvent $event
  * @return string
  */
 public function convert($event)
 {
     switch ($this->type) {
         case LoggerPatternParser::LOG4PHP_LOGGER_PATTERN_PARSER_RELATIVE_TIME_CONVERTER:
             $timeStamp = $event->getTimeStamp();
             $startTime = LoggerLoggingEvent::getStartTime();
             return (string) (int) ($timeStamp * 1000 - $startTime * 1000);
         case LoggerPatternParser::LOG4PHP_LOGGER_PATTERN_PARSER_THREAD_CONVERTER:
             return $event->getThreadName();
         case LoggerPatternParser::LOG4PHP_LOGGER_PATTERN_PARSER_LEVEL_CONVERTER:
             $level = $event->getLevel();
             return $level->toString();
         case LoggerPatternParser::LOG4PHP_LOGGER_PATTERN_PARSER_NDC_CONVERTER:
             return $event->getNDC();
         case LoggerPatternParser::LOG4PHP_LOGGER_PATTERN_PARSER_MESSAGE_CONVERTER:
             return $event->getRenderedMessage();
         default:
             return '';
     }
 }
开发者ID:AnvilStriker,项目名称:owasp-esapi-php,代码行数:24,代码来源:LoggerBasicPatternConverter.php

示例6: colorize

 /**
  * Display coloried messages on console
  *
  * @param LoggerLoggingEvent $event
  * @return string
  */
 public function colorize(LoggerLoggingEvent $event)
 {
     $color = null;
     switch ($event->getLevel()->toString()) {
         case 'INFO':
             $color = self::GREEN;
             break;
         case 'WARN':
             $color = self::YELLOW;
             break;
         case 'ERROR':
             $color = self::RED;
             break;
         case 'FATAL':
             $color = self::BLACK . self::BG_RED;
             break;
     }
     $format = $this->layout->format($event);
     if ($color) {
         $format = $color . $format . self::NOCOLOR;
     }
     return $format;
 }
开发者ID:nterray,项目名称:ForgeUpgrade,代码行数:29,代码来源:LoggerAppenderConsoleColor.php

示例7: doAppend

 /**
  * @see LoggerAppender::doAppend()
  * @param LoggerLoggingEvent $event
  */
 public function doAppend($event)
 {
     LoggerLog::debug("LoggerAppenderSkeleton::doAppend()");
     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->getNext();
         }
     }
     $this->append($event);
 }
开发者ID:5haman,项目名称:knowledgetree,代码行数:28,代码来源:LoggerAppenderSkeleton.php

示例8: format

 /**
  * Returns the log statement in a format consisting of the
  * <b>level</b>, followed by " - " and then the
  * <b>message</b>. For example, 
  * <samp> INFO - "A message" </samp>
  *
  * @param LoggerLoggingEvent $event
  * @return string
  */
 function format($event)
 {
     $level = $event->getLevel();
     return $level->toString() . ' - ' . $event->getRenderedMessage() . LOG4PHP_LINE_SEP;
 }
开发者ID:BackupTheBerlios,项目名称:livealphaprint,代码行数:14,代码来源:LoggerLayoutSimple.php

示例9: append

 function append(LoggerLoggingEvent $event)
 {
     if ($this->canAppend) {
         try {
             // Reopen new mysql connection (need for php threads)
             $this->activateOptions();
             if ($event->message instanceof FarmLogMessage) {
                 $severity = $this->SeverityToInt($event->getLevel()->toString());
                 $message = $event->message->Message;
                 $tm = date('YmdH');
                 $hash = md5(":{$message}:{$event->message->FarmID}:{$event->getLoggerName()}:{$tm}", true);
                 $query = "INSERT DELAYED INTO logentries SET\n                        `id` = ?,\n                        `serverid`\t= '',\n                        `message`\t= ?,\n                        `severity`\t= ?,\n                        `time`\t\t= ?,\n                        `source` \t= ?,\n                        `farmid` \t= ?\n                        ON DUPLICATE KEY UPDATE cnt = cnt + 1, `time` = ?\n                    ";
                 $this->db->Execute($query, array($hash, $message, $severity, time(), $event->getLoggerName(), $event->message->FarmID, time()));
                 $event->message = "[FarmID: {$event->message->FarmID}] {$event->message->Message}";
                 return;
             } elseif ($event->message instanceof ScriptingLogMessage) {
                 $message = $this->db->qstr($event->message->Message);
                 $query = "INSERT DELAYED INTO scripting_log SET\n                        `farmid` \t\t= ?,\n                        `event`\t\t    = ?,\n                        `server_id` \t= ?,\n                        `dtadded`\t\t= NOW(),\n                        `message`\t\t= ?\n                    ";
                 $this->db->Execute($query, array($event->message->FarmID, $event->message->EventName, $event->message->ServerID, $message));
                 $event->message = "[Farm: {$event->message->FarmID}] {$event->message->Message}";
                 return;
             } else {
                 if (stristr($event->message, "AWS was not able to validate the provided access credentials") || stristr($event->message, "The X509 Certificate you provided does not exist in our records")) {
                     return;
                 }
             }
             $level = $event->getLevel()->toString();
             // Redeclare threadName
             $event->threadName = TRANSACTION_ID;
             $event->subThreadName = defined("SUB_TRANSACTIONID") ? SUB_TRANSACTIONID : (isset($GLOBALS["SUB_TRANSACTIONID"]) ? $GLOBALS["SUB_TRANSACTIONID"] : TRANSACTION_ID);
             $event->farmID = defined("LOGGER_FARMID") ? LOGGER_FARMID : (isset($GLOBALS["LOGGER_FARMID"]) ? $GLOBALS["LOGGER_FARMID"] : null);
             if (defined('TRANSACTION_ID')) {
                 if ($level == "FATAL" || $level == "ERROR") {
                     // Set meta information
                     $this->db->Execute("\n                            INSERT DELAYED INTO syslog_metadata\n                            SET transactionid='" . TRANSACTION_ID . "', errors='1', warnings='0'\n                            ON DUPLICATE KEY UPDATE errors=errors+1\n                        ");
                 } else {
                     if ($level == "WARN") {
                         // Set meta information
                         $this->db->Execute("\n                                INSERT DELAYED INTO syslog_metadata\n                                SET transactionid='" . TRANSACTION_ID . "', errors='0', warnings='1'\n                                ON DUPLICATE KEY UPDATE warnings=warnings+1\n                            ");
                     }
                 }
             }
             $msg = $event->message;
             $event->message = $this->db->qstr($event->message);
             $query = $this->layout->format($event);
             $this->db->Execute($query);
             $event->message = $msg;
         } catch (Exception $e) {
         }
     }
 }
开发者ID:rickb838,项目名称:scalr,代码行数:51,代码来源:class.LoggerAppenderScalr.php

示例10: colorize

 /**
  * Display coloried messages on console
  *
  * @param LoggerLoggingEvent $event
  * @return string
  */
 public function colorize(LoggerLoggingEvent $event)
 {
     return $this->chooseColor($event->getLevel()->toString(), $this->layout->format($event));
 }
开发者ID:pombredanne,项目名称:ForgeUpgrade,代码行数:10,代码来源:LoggerAppenderConsoleColor.php

示例11: format

 /**
  * Formats a {@link LoggerLoggingEvent} in conformance with the log4php.dtd.
  *
  * @param LoggerLoggingEvent $event
  * @return string
  */
 public function format(LoggerLoggingEvent $event)
 {
     $loggerName = $event->getLoggerName();
     $timeStamp = number_format((double) ($event->getTimeStamp() * 1000), 0, '', '');
     $thread = $event->getThreadName();
     $level = $event->getLevel();
     $levelStr = $level->toString();
     $buf = "<{$this->_namespacePrefix}:event logger=\"{$loggerName}\" level=\"{$levelStr}\" thread=\"{$thread}\" timestamp=\"{$timeStamp}\">" . PHP_EOL;
     $buf .= "<{$this->_namespacePrefix}:message><![CDATA[";
     $this->appendEscapingCDATA($buf, $event->getRenderedMessage());
     $buf .= "]]></{$this->_namespacePrefix}:message>" . PHP_EOL;
     $ndc = $event->getNDC();
     if ($ndc != null) {
         $buf .= "<{$this->_namespacePrefix}:NDC><![CDATA[";
         $this->appendEscapingCDATA($buf, $ndc);
         $buf .= "]]></{$this->_namespacePrefix}:NDC>" . PHP_EOL;
     }
     if ($this->getLocationInfo()) {
         $locationInfo = $event->getLocationInformation();
         $buf .= "<{$this->_namespacePrefix}:locationInfo " . "class=\"" . $locationInfo->getClassName() . "\" " . "file=\"" . htmlentities($locationInfo->getFileName(), ENT_QUOTES) . "\" " . "line=\"" . $locationInfo->getLineNumber() . "\" " . "method=\"" . $locationInfo->getMethodName() . "\" ";
         $buf .= "/>" . PHP_EOL;
     }
     $buf .= "</{$this->_namespacePrefix}:event>" . PHP_EOL . PHP_EOL;
     return $buf;
 }
开发者ID:bahrmichael,项目名称:eyeos,代码行数:31,代码来源:LoggerLayoutXml.php

示例12: decide

 /**
  * Return the decision of this filter.
  *
  * @param LoggerLoggingEvent $event
  * @return integer
  */
 public function decide(LoggerLoggingEvent $event)
 {
     $level = $event->getLevel();
     if ($this->levelMin !== null) {
         if ($level->isGreaterOrEqual($this->levelMin) == false) {
             // level of event is less than minimum
             return LoggerFilter::DENY;
         }
     }
     if ($this->levelMax !== null) {
         if ($level->toInt() > $this->levelMax->toInt()) {
             // level of event is greater than maximum
             // Alas, there is no Level.isGreater method. and using
             // a combo of isGreaterOrEqual && !Equal seems worse than
             // checking the int values of the level objects..
             return LoggerFilter::DENY;
         }
     }
     if ($this->acceptOnMatch) {
         // this filter set up to bypass later filters and always return
         // accept if level in range
         return LoggerFilter::ACCEPT;
     } else {
         // event is ok for this filter; allow later filters to have a look..
         return LoggerFilter::NEUTRAL;
     }
 }
开发者ID:AnvilStriker,项目名称:owasp-esapi-php,代码行数:33,代码来源:LoggerFilterLevelRange.php

示例13: format

 /**
  * @param LoggerLoggingEvent $event
  * @return string
  */
 public function format(LoggerLoggingEvent $event)
 {
     $sbuf = PHP_EOL . "<tr>" . PHP_EOL;
     $sbuf .= "<td>";
     $sbuf .= $event->getTime();
     $sbuf .= "</td>" . PHP_EOL;
     $sbuf .= "<td title=\"" . $event->getThreadName() . " thread\">";
     $sbuf .= $event->getThreadName();
     $sbuf .= "</td>" . PHP_EOL;
     $sbuf .= "<td title=\"Level\">";
     $level = $event->getLevel();
     if ($level->equals(LoggerLevel::getLevelDebug())) {
         $sbuf .= "<font color=\"#339933\">{$level}</font>";
     } else {
         if ($level->equals(LoggerLevel::getLevelWarn())) {
             $sbuf .= "<font color=\"#993300\"><strong>{$level}</strong></font>";
         } else {
             $sbuf .= $level;
         }
     }
     $sbuf .= "</td>" . PHP_EOL;
     $sbuf .= "<td title=\"" . htmlentities($event->getLoggerName(), ENT_QUOTES) . " category\">";
     $sbuf .= htmlentities($event->getLoggerName(), ENT_QUOTES);
     $sbuf .= "</td>" . PHP_EOL;
     if ($this->locationInfo) {
         $locInfo = $event->getLocationInformation();
         $sbuf .= "<td>";
         $sbuf .= htmlentities($locInfo->getFileName(), ENT_QUOTES) . ':' . $locInfo->getLineNumber();
         $sbuf .= "</td>" . PHP_EOL;
     }
     $sbuf .= "<td title=\"Message\">";
     $sbuf .= htmlentities($event->getRenderedMessage(), ENT_QUOTES);
     $sbuf .= "</td>" . PHP_EOL;
     $sbuf .= "</tr>" . PHP_EOL;
     if ($event->getNDC() != null) {
         $sbuf .= "<tr><td bgcolor=\"#EEEEEE\" style=\"font-size : xx-small;\" colspan=\"6\" title=\"Nested Diagnostic Context\">";
         $sbuf .= "NDC: " . htmlentities($event->getNDC(), ENT_QUOTES);
         $sbuf .= "</td></tr>" . PHP_EOL;
     }
     return $sbuf;
 }
开发者ID:unkerror,项目名称:Budabot,代码行数:45,代码来源:LoggerLayoutHtml.php

示例14: format

 /**
  * Formats a {@link LoggerLoggingEvent} in conformance with the log4php.dtd.
  *
  * @param LoggerLoggingEvent $event        	
  * @return string
  */
 public function format(LoggerLoggingEvent $event)
 {
     $ns = $this->namespacePrefix;
     $loggerName = $event->getLoggerName();
     $timeStamp = number_format((double) ($event->getTimeStamp() * 1000), 0, '', '');
     $thread = $event->getThreadName();
     $level = $event->getLevel()->toString();
     $buf = "<{$ns}:event logger=\"{$loggerName}\" level=\"{$level}\" thread=\"{$thread}\" timestamp=\"{$timeStamp}\">" . PHP_EOL;
     $buf .= "<{$ns}:message>";
     $buf .= $this->encodeCDATA($event->getRenderedMessage());
     $buf .= "</{$ns}:message>" . PHP_EOL;
     $ndc = $event->getNDC();
     if (!empty($ndc)) {
         $buf .= "<{$ns}:NDC><![CDATA[";
         $buf .= $this->encodeCDATA($ndc);
         $buf .= "]]></{$ns}:NDC>" . PHP_EOL;
     }
     $mdcMap = $event->getMDCMap();
     if (!empty($mdcMap)) {
         $buf .= "<{$ns}:properties>" . PHP_EOL;
         foreach ($mdcMap as $name => $value) {
             $buf .= "<{$ns}:data name=\"{$name}\" value=\"{$value}\" />" . PHP_EOL;
         }
         $buf .= "</{$ns}:properties>" . PHP_EOL;
     }
     if ($this->getLocationInfo()) {
         $locationInfo = $event->getLocationInformation();
         $buf .= "<{$ns}:locationInfo " . "class=\"" . $locationInfo->getClassName() . "\" " . "file=\"" . htmlentities($locationInfo->getFileName(), ENT_QUOTES) . "\" " . "line=\"" . $locationInfo->getLineNumber() . "\" " . "method=\"" . $locationInfo->getMethodName() . "\" ";
         $buf .= "/>" . PHP_EOL;
     }
     $buf .= "</{$ns}:event>" . PHP_EOL;
     return $buf;
 }
开发者ID:josefd8,项目名称:dashboardWeb,代码行数:39,代码来源:LoggerLayoutXml.php

示例15: logEvent

 /**
  * Logs an already prepared logging event object. 
  * @param LoggerLoggingEvent $event
  */
 public function logEvent(LoggerLoggingEvent $event)
 {
     if ($this->isEnabledFor($event->getLevel())) {
         $this->callAppenders($event);
     }
     // Forward the event upstream if additivity is turned on
     if (isset($this->parent) && $this->getAdditivity()) {
         $this->parent->logEvent($event);
     }
 }
开发者ID:Lyonard,项目名称:PHPExperiments,代码行数:14,代码来源:Logger.php


注:本文中的LoggerLoggingEvent::getLevel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。