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

PHP LoggerLevel类代码示例

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

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



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

示例1: testConstructWithTimestamp

 public function testConstructWithTimestamp()
 {
     $l = LoggerLevel::getLevelDebug();
     $timestamp = microtime(true);
     $e = new LoggerLoggingEvent('fqcn', 'TestLogger', $l, 'test', $timestamp);
     self::assertEquals($e->getTimeStamp(), $timestamp);
 }
开发者ID:keehao,项目名称:Php-Object-Framework,代码行数:7,代码来源:LoggerLoggingEventTest.php


示例2: getLoggerLevel

 public static function getLoggerLevel($level)
 {
     switch (strtolower($level)) {
         case 'trace':
             $level = LoggerLevel::getLevelTrace();
             break;
         case 'debug':
             $level = LoggerLevel::getLevelDebug();
             break;
         case 'warn':
             $level = LoggerLevel::getLevelWarn();
             break;
         case 'error':
             $level = LoggerLevel::getLevelError();
             break;
         case 'fatal':
             $level = LoggerLevel::getLevelFatal();
             break;
         case 'info':
         default:
             $level = LoggerLevel::getLevelInfo();
             break;
     }
     return $level;
 }
开发者ID:jibinam,项目名称:budabot2,代码行数:25,代码来源:LegacyLogger.class.php


示例3: testSimpleLogging

 public function testSimpleLogging()
 {
     if (!extension_loaded('pdo_sqlite')) {
         self::markTestSkipped("Please install 'pdo_sqlite' in order to run this test");
     }
     $event = new LoggerLoggingEvent("LoggerAppenderPDOTest", new Logger("TEST"), LoggerLevel::getLevelError(), "testmessage");
     $dbname = '../../../target/pdotest.sqlite';
     $dsn = 'sqlite:' . $dbname;
     $database = new PDO($dsn);
     $database = null;
     $appender = new LoggerAppenderPDO("myname");
     $appender->setDSN($dsn);
     $appender->setCreateTable(true);
     $appender->activateOptions();
     $appender->append($event);
     $db = $appender->getDatabaseHandle();
     $q = "select * from log4php_log";
     $error = "";
     if ($result = $db->query($q)) {
         while ($row = $result->fetch()) {
             self::assertEquals($row['1'], 'TEST');
             self::assertEquals($row['2'], 'ERROR');
             self::assertEquals($row['3'], 'testmessage');
         }
     } else {
         // todo propagate exception to phpunit
         self::assertTrue(false);
     }
     $appender->close();
 }
开发者ID:AnvilStriker,项目名称:owasp-esapi-php,代码行数:30,代码来源:LoggerAppenderPDOTest.php


示例4: testActivateOptions

 /**
  * The Null appender does nothing - nothing to assert.
  * Just here for the sake of completness and a good testing ratio :-)
  */
 public function testActivateOptions()
 {
     $event = new LoggerLoggingEvent("LoggerAppenderNullTest", new Logger("TEST"), LoggerLevel::getLevelInfo(), "testmessage");
     $appender = new LoggerAppenderNull("TEST");
     $appender->activateOptions();
     $appender->append($event);
     $appender->close();
 }
开发者ID:keehao,项目名称:Php-Object-Framework,代码行数:12,代码来源:LoggerAppenderNullTest.php


示例5: testErrorLayout

 public function testErrorLayout()
 {
     $event = new LoggerLoggingEvent("LoggerLayoutXml", new Logger("TEST"), LoggerLevel::getLevelError(), "testmessage");
     $e = 'ERROR TEST : testmessage in NA at NA' . PHP_EOL;
     $patternParser = new LoggerPatternParser("%-5p %c %X{username}: %m in %F at %L%n");
     $c = $patternParser->parse();
     $c->format($e, $event);
 }
开发者ID:AnvilStriker,项目名称:owasp-esapi-php,代码行数:8,代码来源:LoggerPatternParserTest.php


示例6: __construct

 /**
  * Constructor
  *
  * @param integer $level initial log level
  */
 public function __construct($level = null)
 {
     parent::__construct('root');
     if ($level == null) {
         $level = LoggerLevel::getLevelAll();
     }
     $this->setLevel($level);
 }
开发者ID:RobertWang,项目名称:sabre-zarafa,代码行数:13,代码来源:LoggerRoot.php


示例7: testInitialSetup

 public function testInitialSetup()
 {
     $root = new LoggerRoot();
     self::assertSame(LoggerLevel::getLevelAll(), $root->getLevel());
     self::assertSame(LoggerLevel::getLevelAll(), $root->getEffectiveLevel());
     self::assertSame('root', $root->getName());
     self::assertNull($root->getParent());
 }
开发者ID:HaakonME,项目名称:noark5-validator,代码行数:8,代码来源:LoggerRootTest.php


示例8: testWarnLayout

 public function testWarnLayout()
 {
     $event = new LoggerLoggingEvent("LoggerLayoutXml", new Logger("TEST"), LoggerLevel::getLevelWarn(), "testmessage");
     $layout = new LoggerLayoutXml();
     $v = $layout->format($event);
     $e = "<log4php:event logger=\"TEST\" level=\"WARN\" thread=\"" . $event->getThreadName() . "\" timestamp=\"" . number_format((double) ($event->getTimeStamp() * 1000), 0, '', '') . "\">" . PHP_EOL . "<log4php:message><![CDATA[testmessage]]></log4php:message>" . PHP_EOL . "<log4php:locationInfo class=\"LoggerLoggingEvent\" file=\"NA\" line=\"NA\" " . "method=\"getLocationInformation\" />" . PHP_EOL . "</log4php:event>\n" . PHP_EOL;
     self::assertEquals($v, $e);
 }
开发者ID:dobreapa,项目名称:owasp-esapi-php,代码行数:8,代码来源:LoggerLayoutXmlTest.php


示例9: testClassnamePattern

 public function testClassnamePattern()
 {
     $event = new LoggerLoggingEvent("LoggerLayoutPatternTest", new Logger("TEST"), LoggerLevel::getLevelError(), "testmessage");
     $v = $this->formatEvent($event, '%C');
     $dt = $this->getEventDateTime($event);
     $e = "LoggerLayoutPatternTest";
     self::assertEquals($e, $v);
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:8,代码来源:LoggerLayoutPatternTest.php


示例10: testSimpleLayout

 public function testSimpleLayout()
 {
     $event = new LoggerLoggingEvent("LoggerLayoutSimpleTest", new Logger("TEST"), LoggerLevel::getLevelError(), "testmessage");
     $layout = new LoggerLayoutSimple();
     $v = $layout->format($event);
     $e = "ERROR - testmessage\n";
     self::assertEquals($v, $e);
 }
开发者ID:sacredwebsite,项目名称:scalr,代码行数:8,代码来源:LoggerLayoutSimpleTest.php


示例11: testWarnLayout

 public function testWarnLayout()
 {
     $event = new LoggerLoggingEvent("LoggerLayoutHtmlTest", new Logger("TEST"), LoggerLevel::getLevelWarn(), "testmessage");
     $layout = new LoggerLayoutHtml();
     $v = $layout->format($event);
     $e = PHP_EOL . "<tr>" . PHP_EOL . "<td>" . round(1000 * $event->getRelativeTime()) . "</td>" . PHP_EOL . "<td title=\"" . $event->getThreadName() . " thread\">" . $event->getThreadName() . "</td>" . PHP_EOL . "<td title=\"Level\"><font color=\"#993300\"><strong>WARN</strong></font></td>" . PHP_EOL . "<td title=\"TEST category\">TEST</td>" . PHP_EOL . "<td title=\"Message\">testmessage</td>" . PHP_EOL . "</tr>" . PHP_EOL;
     self::assertEquals($v, $e);
 }
开发者ID:scottleedavis,项目名称:hackazon,代码行数:8,代码来源:LoggerLayoutHtmlTest.php


示例12: LoggerRoot

 /**
  * Constructor
  *
  * @param integer $level initial log level
  */
 function LoggerRoot($level = null)
 {
     $this->Logger($this->name);
     if ($level == null) {
         $level = LoggerLevel::getLevelAll();
     }
     $this->setLevel($level);
 }
开发者ID:miztaka,项目名称:teeple2,代码行数:13,代码来源:LoggerRoot.php


示例13: testSimpleLayout

 public function testSimpleLayout()
 {
     $event = new LoggerLoggingEvent("LoggerLayoutSimpleTest", new Logger("TEST"), LoggerLevel::getLevelError(), "testmessage");
     $layout = new LoggerLayoutSimple();
     $actual = $layout->format($event);
     $expected = "ERROR - testmessage" . PHP_EOL;
     self::assertEquals($expected, $actual);
 }
开发者ID:HaakonME,项目名称:noark5-validator,代码行数:8,代码来源:LoggerLayoutSimpleTest.php


示例14: log

 /**
  * Logs with an arbitrary level.
  *
  * @param mixed $level
  * @param mixed $message
  * @param mixed[] $context
  * @return null
  */
 public function log($level, $message, array $context = array())
 {
     if (!array_key_exists($level, $this->levels)) {
         $level = $this->defaultLevel;
     }
     $level = \LoggerLevel::toLevel($this->levels[$level], $this->defaultLevel);
     $message = $this->formatter->format($level, $message, $context);
     $this->logger->log($level, $message);
 }
开发者ID:abacaphiliac,项目名称:psr-log4php,代码行数:17,代码来源:LoggerWrapper.php


示例15: testClassname

 public function testClassname()
 {
     $event = new LoggerLoggingEvent("MyClass", new Logger("TEST"), LoggerLevel::getLevelError(), "testmessage");
     $expected = 'MyClass';
     $patternParser = new LoggerPatternParser("%C");
     $c = $patternParser->parse();
     $actual = '';
     $c->format($actual, $event);
     self::assertEquals($expected, $actual);
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:10,代码来源:LoggerPatternParserTest.php


示例16: testSimpleDefaultLogging

 public function testSimpleDefaultLogging()
 {
     $layout = new LoggerLayoutSimple();
     $event = new LoggerLoggingEvent('LoggerAppenderConsoleTest', new Logger('mycategory'), LoggerLevel::getLevelWarn(), "my message");
     $appender = new LoggerAppenderConsole("mylogger");
     $appender->setLayout($layout);
     $appender->activateOptions();
     $appender->append($event);
     $appender->close();
 }
开发者ID:dobreapa,项目名称:owasp-esapi-php,代码行数:10,代码来源:LoggerAppenderConsoleTest.php


示例17: testConfigureWithRootCategory

 public function testConfigureWithRootCategory()
 {
     Logger::configure('configurators/test3.properties');
     $root = Logger::getRootLogger();
     self::assertEquals(LoggerLevel::getLevelWarn(), $root->getLevel());
     $appender = $root->getAppender("default");
     self::assertTrue($appender instanceof LoggerAppenderEcho);
     $layout = $appender->getLayout();
     self::assertTrue($layout instanceof LoggerLayoutSimple);
 }
开发者ID:dobreapa,项目名称:owasp-esapi-php,代码行数:10,代码来源:LoggerConfiguratorIniTest.php


示例18: testSocketProblem

 /** Tests Exception due to unreachable remote host.
  * 
  * @expectedException LoggerException
  */
 public function testSocketProblem()
 {
     $appender = new LoggerAppenderSocket("myname ");
     $appender->setDry(false);
     $appender->setRemoteHost("does.not.exists");
     $appender->setPort(1234);
     $appender->activateOptions();
     $event = new LoggerLoggingEvent("LoggerAppenderSocketTest", new Logger("TEST"), LoggerLevel::getLevelError(), "testmessage");
     $appender->append($event);
 }
开发者ID:sacredwebsite,项目名称:scalr,代码行数:14,代码来源:LoggerAppenderSocketTest.php


示例19: testConfigure

 public function testConfigure()
 {
     Logger::configure('configurators/test1.php', 'LoggerConfiguratorPhp');
     $root = Logger::getRootLogger();
     self::assertEquals(LoggerLevel::getLevelWarn(), $root->getLevel());
     $appender = $root->getAppender("default");
     self::assertTrue($appender instanceof LoggerAppenderEcho);
     $layout = $appender->getLayout();
     self::assertTrue($layout instanceof LoggerLayoutSimple);
     $logger = Logger::getLogger('mylogger');
     self::assertEquals(LoggerLevel::getLevelInfo(), $logger->getLevel());
 }
开发者ID:dobreapa,项目名称:owasp-esapi-php,代码行数:12,代码来源:LoggerConfiguratorPhpTest.php


示例20: testPhp

 public function testPhp()
 {
     $appender = new LoggerAppenderPhp("TEST");
     $layout = new LoggerLayoutSimple();
     $appender->setLayout($layout);
     $appender->activateOptions();
     $event = new LoggerLoggingEvent("LoggerAppenderPhpTest", new Logger("TEST"), LoggerLevel::getLevelError(), "testmessage");
     $appender->append($event);
     $event = new LoggerLoggingEvent("LoggerAppenderPhpTest", new Logger("TEST"), LoggerLevel::getLevelWarn(), "testmessage");
     $appender->append($event);
     $event = new LoggerLoggingEvent("LoggerAppenderPhpTest", new Logger("TEST"), LoggerLevel::getLevelDebug(), "testmessage");
     $appender->append($event);
 }
开发者ID:dobreapa,项目名称:owasp-esapi-php,代码行数:13,代码来源:LoggerAppenderPhpTest.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP LoggerLog类代码示例发布时间:2022-05-23
下一篇:
PHP LoggerAppender类代码示例发布时间: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