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


PHP CakeLog::configured方法代码示例

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


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

示例1: __construct

 /**
  * Constructor - sets up the log listener.
  *
  * @return \LogPanel
  */
 public function __construct()
 {
     parent::__construct();
     $existing = CakeLog::configured();
     if (empty($existing)) {
         CakeLog::config('default', array('engine' => 'FileLog'));
     }
     CakeLog::config('debug_kit_log_panel', array('engine' => 'DebugKit.DebugKitLog', 'panel' => $this));
 }
开发者ID:gjcamacho,项目名称:blog_test,代码行数:14,代码来源:LogPanel.php

示例2: read

 /**
  * Parse and read syslogs.
  *
  * @param string $type
  * @throws NotFoundException
  * @throws BadRequestException
  */
 public function read($type = 'debug')
 {
     $path = TMP . 'logs/' . $type . '.log';
     $logs = array();
     $exceptions = array();
     $message = null;
     if (!in_array($type, CakeLog::configured())) {
         throw new NotFoundException(__d('admin', '%s Log Not Found', Inflector::humanize($type)));
     }
     if (file_exists($path)) {
         if (filesize($path) > 2097152) {
             throw new BadRequestException(__d('admin', 'Can not read %s as it exceeds 2MB', basename($path)));
         }
         if ($file = file($path, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES)) {
             $log = array();
             foreach ($file as $line) {
                 // Exception message
                 if (preg_match('/^([0-9\\-:\\s]+)\\s([a-z]+:)\\s(?:\\[([a-z]+)\\])?\\s?(.*?)$/i', $line, $matches)) {
                     $exception = $matches[3];
                     // Save the previous log
                     if ($log) {
                         $key = md5($log['url'] . $log['message']);
                         if (isset($logs[$key])) {
                             $logs[$key]['count']++;
                         } else {
                             $logs[$key] = $log;
                         }
                     }
                     // Start a new log
                     $log = array('line' => $line, 'exception' => $exception, 'message' => $matches[4], 'stack' => array(), 'count' => 1, 'date' => $matches[1], 'url' => null);
                     if ($exception) {
                         $exceptions[$exception][] = $matches[1];
                     }
                     // Request URL
                 } else {
                     if (preg_match('/^Request URL: (.*?)$/i', $line, $matches)) {
                         $log['url'] = $matches[1];
                         // Stack trace
                     } else {
                         if ($line[0] === '#') {
                             $log['stack'][] = $line . PHP_EOL;
                         }
                     }
                 }
             }
         }
         // Sort by count
         usort($logs, function ($a, $b) {
             return $b['count'] - $a['count'];
         });
     }
     $this->set('type', $type);
     $this->set('logs', $logs);
     $this->set('exceptions', $exceptions);
 }
开发者ID:johnulist,项目名称:admin-1,代码行数:62,代码来源:LogsController.php

示例3: testConstructor

 /**
  * Test that logging configs are created.
  *
  * @return void
  */
 public function testConstructor()
 {
     $result = CakeLog::configured();
     $this->assertContains('debug_kit_log_panel', $result);
     $this->assertTrue(count($result) > 1, 'Default loggers were not added.');
 }
开发者ID:huanjian,项目名称:mythesis,代码行数:11,代码来源:LogPanelTest.php

示例4: testDrop

	/**
	 * explict tests for drop()
	 *
	 * @return void
	 **/
	function testDrop() {
		CakeLog::config('file', array(
			'engine' => 'FileLog',
			'path' => LOGS
		));
		$result = CakeLog::configured();
		$this->assertEqual($result, array('file'));

		CakeLog::drop('file');
		$result = CakeLog::configured();
		$this->assertEqual($result, array());
	}
开发者ID:ralmeida,项目名称:FoundFree.org,代码行数:17,代码来源:cake_log.test.php

示例5: _loggerIsConfigured

 /**
  * Checks if the given logger is configured
  * 
  * @param string $logger The name of the logger to check 
  * @return bool
  */
 protected function _loggerIsConfigured($logger)
 {
     $configured = CakeLog::configured();
     return in_array($logger, $configured);
 }
开发者ID:hodrigohamalho,项目名称:cakephp-ex,代码行数:11,代码来源:Shell.php

示例6: testLogPanelConstructCreatingDefaultLogConfiguration

/**
 * test that creating the log panel creates the default file logger if none
 * are configured.  This stops DebugKit from mucking with the default auto-magic log config
 *
 * @return void
 */
	public function testLogPanelConstructCreatingDefaultLogConfiguration() {
		$this->_loadController();

		CakeLog::drop('default');
		CakeLog::drop('debug_kit_log_panel');

		$panel = new LogPanel(array());
		$configured = CakeLog::configured();

		$this->assertTrue(in_array('default', $configured));
		$this->assertTrue(in_array('debug_kit_log_panel', $configured));
	}
开发者ID:neterslandreau,项目名称:tubones,代码行数:18,代码来源:ToolbarComponentTest.php

示例7: testDrop

 /**
  * explicit tests for drop()
  *
  * @return void
  */
 public function testDrop()
 {
     CakeLog::config('file', array('engine' => 'File', 'path' => LOGS));
     $result = CakeLog::configured();
     $this->assertEquals(array('file'), $result);
     CakeLog::drop('file');
     $result = CakeLog::configured();
     $this->assertSame(array(), $result);
 }
开发者ID:yuuicchan0912,项目名称:sample1,代码行数:14,代码来源:CakeLogTest.php

示例8: __construct

 /**
  * Constructor - sets up the log listener.
  *
  * @return void
  */
 function __construct($settings)
 {
     parent::__construct();
     if (!class_exists('CakeLog')) {
         App::import('Core', 'CakeLog');
     }
     $existing = CakeLog::configured();
     if (empty($existing)) {
         CakeLog::config('default', array('engine' => 'FileLog'));
     }
     CakeLog::config('debug_kit_log_panel', array('engine' => 'DebugKitLogListener', 'panel' => $this));
 }
开发者ID:ambagasdowa,项目名称:kml,代码行数:17,代码来源:toolbar.php

示例9: _restoresForSetup

 /**
  * Restore original scopes on all loggers
  */
 public function _restoresForSetup()
 {
     foreach (CakeLog::configured() as $name) {
         $logger = CakeLog::stream($name);
         if (!method_exists($logger, 'config')) {
             continue;
         }
         $config = $logger->config();
         if (!array_key_exists('scopes_backup', $config)) {
             continue;
         }
         $config['scopes'] = $config['scopes_backup'];
         unset($config['scopes_backup']);
         $logger->config($config);
     }
 }
开发者ID:beckye67,项目名称:Icing,代码行数:19,代码来源:AppFastFixture.php


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