• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP LoggerLoggingEvent类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: convert

 public function convert(LoggerLoggingEvent $event)
 {
     if ($this->useLocalDate) {
         return $this->date($this->format, $event->getTimeStamp());
     }
     return date($this->format, $event->getTimeStamp());
 }
开发者ID:HaakonME,项目名称:noark5-validator,代码行数:7,代码来源:LoggerPatternConverterDate.php


示例2: convert

 /**
  * @param LoggerLoggingEvent $event
  * @return string
  */
 public function convert($event)
 {
     $timeStamp = $event->getTimeStamp();
     $usecs = round(($timeStamp - (int) $timeStamp) * 1000);
     $this->df = preg_replace('/((?<!\\\\)(?:\\\\{2})*)u/', '${1}' . sprintf('%03d', $usecs), $this->df);
     return date($this->df, $event->getTimeStamp());
 }
开发者ID:BGCX067,项目名称:ezboss-svn-to-git,代码行数:11,代码来源:LoggerDatePatternConverter.php


示例3: append

 /**
  * Appends a logging event.
  *
  * If the target file changes because of passage of time (e.g. at midnight)
  * the current file is closed. A new file, with the new date, will be
  * opened by the write() method.
  */
 public function append(LoggerLoggingEvent $event)
 {
     $eventDate = $this->getDate($event->getTimestamp());
     // Initial setting of current date
     if (!isset($this->currentDate)) {
         $this->currentDate = $eventDate;
     } else {
         if ($this->currentDate !== $eventDate) {
             $this->currentDate = $eventDate;
             // Close the file if it's open.
             // Note: $this->close() is not called here because it would set
             //       $this->closed to true and the appender would not recieve
             //       any more logging requests
             if (is_resource($this->fp)) {
                 $this->write($this->layout->getFooter());
                 fclose($this->fp);
             }
             $this->fp = null;
         }
     }
     //$this->rollOver();
     //var_dump($this);
     //parent::append($event);
     $this->write($this->layout->getFooter());
 }
开发者ID:dru-id,项目名称:druid-php-sdk,代码行数:32,代码来源:LoggerAppenderDailyRollingFile.php


示例4: format

 public function format(LoggerLoggingEvent $event)
 {
     // If required, initialize the location data
     if ($this->locationInfo) {
         $event->getLocationInformation();
     }
     return serialize($event) . PHP_EOL;
 }
开发者ID:HaakonME,项目名称:noark5-validator,代码行数:8,代码来源:LoggerLayoutSerialized.php


示例5: convert

 public function convert(LoggerLoggingEvent $event)
 {
     $info = $event->getThrowableInformation();
     if (isset($info)) {
         $ex = $info->getThrowable();
         return (string) $ex . PHP_EOL;
     }
     return '';
 }
开发者ID:keehao,项目名称:Php-Object-Framework,代码行数:9,代码来源:LoggerPatternConverterThrowable.php


示例6: convert

 public function convert(LoggerLoggingEvent $event)
 {
     $info = $event->getThrowableInformation();
     if (isset($info)) {
         $ex = $info->getThrowable();
         return $this->getExceptionTraceAsString($ex) . PHP_EOL;
     }
     return '';
 }
开发者ID:Vbyec,项目名称:frame,代码行数:9,代码来源:LoggerPatternConverterThrowable.php


示例7: decide

 /**
  * @return integer a {@link LOGGER_FILTER_NEUTRAL} is there is no string match.
  */
 public function decide(LoggerLoggingEvent $event)
 {
     $msg = $event->getRenderedMessage();
     if ($msg === null or $this->stringToMatch === null) {
         return LoggerFilter::NEUTRAL;
     }
     if (strpos($msg, $this->stringToMatch) !== false) {
         return $this->acceptOnMatch ? LoggerFilter::ACCEPT : LoggerFilter::DENY;
     }
     return LoggerFilter::NEUTRAL;
 }
开发者ID:jjaferson,项目名称:ourives,代码行数:14,代码来源:LoggerFilterStringMatch.php


示例8: 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


示例9: decide

 /**
  * @return integer a {@link LOGGER_FILTER_NEUTRAL} is there is no string match.
  */
 function decide(LoggerLoggingEvent $event)
 {
     $category = $event->getLoggerName();
     if ($category === null or $this->stringToMatch === null) {
         return LoggerFilter::NEUTRAL;
     }
     if (preg_match($this->stringToMatch, $category)) {
         return $this->acceptOnMatch ? LoggerFilter::ACCEPT : LoggerFilter::NEUTRAL;
     } else {
         return LoggerFilter::DENY;
     }
 }
开发者ID:rickb838,项目名称:scalr,代码行数:15,代码来源:class.LoggerFilterCategoryMatch.php


示例10: convert

 public function convert(LoggerLoggingEvent $event)
 {
     $name = $event->getLocationInformation()->getClassName();
     if (!isset($this->cache[$name])) {
         // If length is set return shortened class name
         if (isset($this->length)) {
             $this->cache[$name] = LoggerUtils::shortenClassName($name, $this->length);
         } else {
             $this->cache[$name] = $name;
         }
     }
     return $this->cache[$name];
 }
开发者ID:ActiveWebsite,项目名称:BoojPressPlugins,代码行数:13,代码来源:LoggerPatternConverterClass.php


示例11: 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


示例12: convert

 public function convert(LoggerLoggingEvent $event)
 {
     if (isset($this->key)) {
         return $event->getMDC($this->key);
     } else {
         $buff = array();
         $map = $event->getMDCMap();
         foreach ($map as $key => $value) {
             $buff[] = "{$key}={$value}";
         }
         return implode(', ', $buff);
     }
 }
开发者ID:gustavoghioldi,项目名称:Plugin-opencart2,代码行数:13,代码来源:LoggerPatternConverterMDC.php


示例13: 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


示例14: testGetStartTime

 public function testGetStartTime()
 {
     $time = LoggerLoggingEvent::getStartTime();
     self::assertInternalType('float', $time);
     $time2 = LoggerLoggingEvent::getStartTime();
     self::assertEquals($time, $time2);
 }
开发者ID:keehao,项目名称:Php-Object-Framework,代码行数:7,代码来源:LoggerLoggingEventTest.php


示例15: convert

 /**
  * @param LoggerLoggingEvent $event
  * @return string
  */
 public function convert($event)
 {
     $locationInfo = $event->getLocationInformation();
     switch ($this->type) {
         case LoggerPatternParser::LOG4PHP_LOGGER_PATTERN_PARSER_FULL_LOCATION_CONVERTER:
             return $locationInfo->getFullInfo();
         case LoggerPatternParser::LOG4PHP_LOGGER_PATTERN_PARSER_METHOD_LOCATION_CONVERTER:
             return $locationInfo->getMethodName();
         case LoggerPatternParser::LOG4PHP_LOGGER_PATTERN_PARSER_LINE_LOCATION_CONVERTER:
             return $locationInfo->getLineNumber();
         case LoggerPatternParser::LOG4PHP_LOGGER_PATTERN_PARSER_FILE_LOCATION_CONVERTER:
             return $locationInfo->getFileName();
         default:
             return '';
     }
 }
开发者ID:dobreapa,项目名称:owasp-esapi-php,代码行数:20,代码来源:LoggerLocationPatternConverter.php


示例16: convert

 /**
  * @param LoggerLoggingEvent $event
  * @return string
  */
 public function convert($event)
 {
     $locationInfo = $event->getLocationInformation();
     switch ($this->type) {
         case LoggerPatternParser::FULL_LOCATION_CONVERTER:
             return $locationInfo->getFullInfo();
         case LoggerPatternParser::METHOD_LOCATION_CONVERTER:
             return $locationInfo->getMethodName();
         case LoggerPatternParser::LINE_LOCATION_CONVERTER:
             return $locationInfo->getLineNumber();
         case LoggerPatternParser::FILE_LOCATION_CONVERTER:
             return $locationInfo->getFileName();
         case LoggerPatternParser::CLASS_LOCATION_CONVERTER:
             return $locationInfo->getFullQualifiedClassname();
         default:
             return '';
     }
 }
开发者ID:unkerror,项目名称:Budabot,代码行数:22,代码来源:LoggerLocationPatternConverter.php


示例17: 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


示例18: 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


示例19: 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 = $this->db->qstr($event->message->Message);
                 $query = "INSERT DELAYED INTO logentries SET \r\n\t        \t\t\tserverid\t= '', \r\n\t        \t\t\tmessage\t\t= {$message},\r\n\t        \t\t\tseverity\t= '{$severity}',\r\n\t        \t\t\ttime\t\t= '" . time() . "',\r\n\t        \t\t\tsource \t\t= '" . $event->getLoggerName() . "',\r\n\t        \t\t\tfarmid \t\t= '{$event->message->FarmID}' \r\n\t        \t\t";
                 $this->db->Execute($query);
                 $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 \r\n\t        \t\t\tfarmid \t\t= '{$event->message->FarmID}',\r\n\t        \t\t\tevent\t\t= '{$event->message->EventName}',\r\n\t        \t\t\tserver_id\t= '{$event->message->ServerID}',\r\n\t        \t\t\tdtadded\t\t= NOW(),\r\n\t        \t\t\tmessage\t\t= {$message}\r\n\t        \t\t";
                 $this->db->Execute($query);
                 $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 : $GLOBALS["SUB_TRANSACTIONID"] ? $GLOBALS["SUB_TRANSACTIONID"] : TRANSACTION_ID;
             $event->farmID = defined("LOGGER_FARMID") ? LOGGER_FARMID : $GLOBALS["LOGGER_FARMID"] ? $GLOBALS["LOGGER_FARMID"] : null;
             if (defined('TRANSACTION_ID')) {
                 if ($level == "FATAL" || $level == "ERROR") {
                     // Set meta information
                     $this->db->Execute("INSERT DELAYED INTO syslog_metadata SET transactionid='" . TRANSACTION_ID . "', errors='1', warnings='0'\r\n\t\t        \t\t\tON DUPLICATE KEY UPDATE errors=errors+1\r\n\t\t        \t\t");
                 } else {
                     if ($level == "WARN") {
                         // Set meta information
                         $this->db->Execute("INSERT DELAYED INTO syslog_metadata SET transactionid='" . TRANSACTION_ID . "', errors='0', warnings='1'\r\n\t\t\t        \t\t\tON DUPLICATE KEY UPDATE warnings=warnings+1\r\n\t\t\t        \t\t");
                     }
                 }
             }
             $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:rakesh-mohanta,项目名称:scalr,代码行数:49,代码来源:class.LoggerAppenderScalr.php


示例20: 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;
     }
 }
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:24,代码来源:LoggerAppenderFirePHP.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP LoggerManager类代码示例发布时间:2022-05-23
下一篇:
PHP LoggerLog类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap