當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Log::config方法代碼示例

本文整理匯總了PHP中Cake\Log\Log::config方法的典型用法代碼示例。如果您正苦於以下問題:PHP Log::config方法的具體用法?PHP Log::config怎麽用?PHP Log::config使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Cake\Log\Log的用法示例。


在下文中一共展示了Log::config方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __construct

 /**
  * Constructor - sets up the log listener.
  *
  * @return \LogPanel
  */
 public function __construct()
 {
     if (Log::config('debug_kit_log_panel')) {
         return;
     }
     Log::config('debug_kit_log_panel', array('engine' => 'DebugKit.DebugKit'));
 }
開發者ID:meotimdihia,項目名稱:cakephp-test-elasticsearch,代碼行數:12,代碼來源:LogPanel.php

示例2: initialize

 /**
  * Initialize hook - sets up the log listener.
  *
  * @return \LogPanel
  */
 public function initialize()
 {
     if (Log::config('debug_kit_log_panel')) {
         return;
     }
     Log::config('debug_kit_log_panel', ['engine' => 'DebugKit.DebugKit']);
 }
開發者ID:jeremyharris,項目名稱:debug_kit,代碼行數:12,代碼來源:LogPanel.php

示例3: testValidKeyName

 /**
  * test config() with valid key name
  *
  * @return void
  */
 public function testValidKeyName()
 {
     Log::config('stdout', ['engine' => 'File']);
     Queue::config('valid', ['url' => 'mysql://username:password@localhost:80/database']);
     $engine = Queue::engine('valid');
     $this->assertInstanceOf('josegonzalez\\Queuesadilla\\Engine\\MysqlEngine', $engine);
 }
開發者ID:cleptric,項目名稱:cakephp-queuesadilla,代碼行數:12,代碼來源:QueueTest.php

示例4: testGetEngine

 /**
  * Test that the worker is an instance of the correct object
  *
  * @return void
  */
 public function testGetEngine()
 {
     Log::config('stdout', ['engine' => 'File']);
     Queue::config('default', ['url' => 'mysql://username:password@localhost:80/database']);
     $logger = new NullLogger();
     $this->shell->params['config'] = 'default';
     $engine = $this->shell->getEngine($logger);
     $this->assertInstanceOf('josegonzalez\\Queuesadilla\\Engine\\MysqlEngine', $engine);
 }
開發者ID:josegonzalez,項目名稱:cakephp-queuesadilla,代碼行數:14,代碼來源:QueuesadillaShellTest.php

示例5: testBeforeDispatch

 /**
  * Test that beforeDispatch call initialize on each panel
  *
  * @return void
  */
 public function testBeforeDispatch()
 {
     $bar = new DebugBarFilter($this->events, []);
     $bar->setup();
     $this->assertNull(Log::config('debug_kit_log_panel'));
     $event = new Event('Dispatcher.beforeDispatch');
     $bar->beforeDispatch($event);
     $this->assertNotEmpty(Log::config('debug_kit_log_panel'), 'Panel attached logger.');
 }
開發者ID:rodrigoraj,項目名稱:debug_kit,代碼行數:14,代碼來源:DebugBarFilterTest.php

示例6: testLogging

 /**
  * testLogging
  *
  * @return void
  */
 public function testLogging()
 {
     Log::config('dblogtest', ['className' => 'Burzum\\DatabaseLog\\Log\\Engine\\DatabaseLog', 'levels' => ['warning', 'error', 'critical', 'alert', 'emergency']]);
     Log::write('warning', 'testing');
     $result = $this->Logs->find()->first();
     $this->assertEquals($result->level, 'warning');
     $this->assertEquals($result->message, 'testing');
     $this->Logs->deleteAll([]);
 }
開發者ID:burzum,項目名稱:cakephp-database-log,代碼行數:14,代碼來源:DatabaseLogTest.php

示例7: testLog

 /**
  * Test log method.
  *
  * @return void
  */
 public function testLog()
 {
     $mock = $this->getMockBuilder('Psr\\Log\\LoggerInterface')->getMock();
     $mock->expects($this->at(0))->method('log')->with('error', 'Testing');
     $mock->expects($this->at(1))->method('log')->with('debug', [1, 2]);
     Log::config('trait_test', ['engine' => $mock]);
     $subject = $this->getObjectForTrait('Cake\\Log\\LogTrait');
     $subject->log('Testing');
     $subject->log([1, 2], 'debug');
 }
開發者ID:rashmi,項目名稱:newrepo,代碼行數:15,代碼來源:LogTraitTest.php

示例8: testLog

 /**
  * Test log method.
  *
  * @return void
  */
 public function testLog()
 {
     $mock = $this->getMock('Cake\\Log\\LogInterface');
     $mock->expects($this->at(0))->method('write')->with('error', 'Testing');
     $mock->expects($this->at(1))->method('write')->with('debug', print_r(array(1, 2), true));
     Log::config('trait_test', ['engine' => $mock]);
     $subject = $this->getObjectForTrait('Cake\\Log\\LogTrait');
     $subject->log('Testing');
     $subject->log(array(1, 2), 'debug');
 }
開發者ID:ripzappa0924,項目名稱:carte0.0.1,代碼行數:15,代碼來源:LogTraitTest.php

示例9: startup

 /**
  * {@inheritdoc}
  */
 public function startup()
 {
     foreach (Config::get('cake_orm.datasources', []) as $name => $dataSource) {
         ConnectionManager::config($name, $dataSource);
     }
     Cache::config(Config::get('cake_orm.cache', []));
     if (!is_dir($cakeLogPath = LOG_DIR . DS . 'cake')) {
         mkdir($cakeLogPath, 0777, true);
     }
     Log::config('queries', ['className' => 'File', 'path' => LOG_DIR . DS . 'cake' . DS, 'file' => 'queries.log', 'scopes' => ['queriesLog']]);
     $this->getEventManager()->addSubscriber(new CakeORMSubscriber());
 }
開發者ID:radphp,項目名稱:cake-orm-bundle,代碼行數:15,代碼來源:CakeOrmBundle.php

示例10: setUp

 /**
  * setup create a request object to get out of router later.
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     Router::reload();
     $request = new Request();
     $request->base = '';
     Router::setRequestInfo($request);
     Configure::write('debug', true);
     $this->_logger = $this->getMock('Psr\\Log\\LoggerInterface');
     Log::reset();
     Log::config('error_test', ['engine' => $this->_logger]);
 }
開發者ID:JesseDarellMoore,項目名稱:CS499,代碼行數:17,代碼來源:ErrorHandlerTest.php

示例11: seeSentEmailContains

 /**
  * Checks that sent email(s) contain `$content`.
  *
  * This requires the email profile(s) used to have `log` equals to
  * `['level' => 'info', 'scope' => 'email']` and a new `email` logging
  * configuration defined as follow:
  *
  * ```
  * 'email' => [
  *     'className' => 'Cake\Log\Engine\FileLog',
  *     'path' => LOGS,
  *     'file' => 'email',
  *     'levels' => ['info'],
  *     'scope' => ['email'],
  * ],
  * ```
  *
  * Finally, it requires the `tests/bootstrap.php` to have:
  *
  * ```
  * use Cake\Log\Log;
  *
  * $logTestConfig = ['path' => TMP . 'tests' . DS] + Log::config('email');
  * Log::drop('email');
  * Log::config('email', $logTestConfig);
  * ```
  *
  * @param array|string $content Content to check for.
  * @return void
  */
 public function seeSentEmailContains($content)
 {
     $logConfig = Log::config('email');
     $path = $logConfig['path'] . $logConfig['file'] . '.log';
     if (!file_exists($path) || !($log = file_get_contents($path))) {
         $this->fail('No email set, cannot assert content.');
     }
     $contents = (array) $content;
     $this->debugSection('email.log', $log);
     foreach ($contents as $content) {
         $this->assertContains($content, $log);
     }
     unlink($path);
 }
開發者ID:cakephp,項目名稱:codeception,代碼行數:44,代碼來源:MailerTrait.php

示例12: onBootstrap

 public function onBootstrap(MvcEvent $e)
 {
     /* 
      * pega as configurações
      */
     $config = $e->getApplication()->getServiceManager()->get('Config');
     /* 
      * arruma a configuração do cakePHP
      */
     $config['CakePHP']['Cache']['_cake_model_']['duration'] = $config['caches']['Zend\\Cache']['options']['ttl'];
     $config['CakePHP']['Datasources']['default']['host'] = $config['db']['adapters']['Zend\\Db\\Adapter']['host'];
     $config['CakePHP']['Datasources']['default']['username'] = $config['db']['adapters']['Zend\\Db\\Adapter']['username'];
     $config['CakePHP']['Datasources']['default']['password'] = $config['db']['adapters']['Zend\\Db\\Adapter']['password'];
     $config['CakePHP']['Datasources']['default']['database'] = $config['db']['adapters']['Zend\\Db\\Adapter']['dbname'];
     /* 
      * seta o namespace padrão do CakePHP (App\Model)
      */
     foreach ($config['CakePHP']['Configure'] as $configKey => $configValue) {
         Configure::write($configKey, $configValue);
     }
     /* 
      * configura o cache do CakePHP
      */
     foreach ($config['CakePHP']['Cache'] as $configKey => $configValue) {
         $cacheDir = sprintf('%s/%s', ROOT_PATH, $configValue['path']);
         if (!is_dir($cacheDir)) {
             @mkdir($cacheDir, 0755, true);
         }
         Cache::config($configKey, $configValue);
     }
     /* 
      * configura o log do CakePHP
      */
     foreach ($config['CakePHP']['Log'] as $configKey => $configValue) {
         $logDir = sprintf('%s/%s', ROOT_PATH, $configValue['path']);
         if (!is_dir($logDir)) {
             @mkdir($logDir, 0755, true);
         }
         Log::config($configKey, $configValue);
     }
     /* 
      * setup da conexão com banco de dados no CakePHP
      */
     foreach ($config['CakePHP']['Datasources'] as $configKey => $configValue) {
         ConnectionManager::config($configKey, $configValue);
     }
 }
開發者ID:armenio,項目名稱:armenio-zf2-cakephp-orm-module,代碼行數:47,代碼來源:Module.php

示例13: testLogSchemaWithDebug

 /**
  * Test logging depends on fixture manager debug.
  *
  * @return void
  */
 public function testLogSchemaWithDebug()
 {
     $db = ConnectionManager::get('test');
     $restore = $db->logQueries();
     $db->logQueries(true);
     $this->manager->setDebug(true);
     $buffer = new ConsoleOutput();
     Log::config('testQueryLogger', ['className' => 'Console', 'stream' => $buffer]);
     $test = $this->getMock('Cake\\TestSuite\\TestCase');
     $test->fixtures = ['core.articles'];
     $this->manager->fixturize($test);
     // Need to load/shutdown twice to ensure fixture is created.
     $this->manager->load($test);
     $this->manager->shutdown();
     $this->manager->load($test);
     $this->manager->shutdown();
     $db->logQueries($restore);
     $this->assertContains('CREATE TABLE', implode('', $buffer->messages()));
 }
開發者ID:kfer10,項目名稱:excel,代碼行數:24,代碼來源:FixtureManagerTest.php

示例14: testConvenienceMethods

 /**
  * test convenience methods
  */
 public function testConvenienceMethods()
 {
     $this->_deleteLogs();
     Log::config('debug', array('engine' => 'File', 'types' => array('notice', 'info', 'debug'), 'file' => 'debug'));
     Log::config('error', array('engine' => 'File', 'types' => array('emergency', 'alert', 'critical', 'error', 'warning'), 'file' => 'error'));
     $testMessage = 'emergency message';
     Log::emergency($testMessage);
     $contents = file_get_contents(LOGS . 'error.log');
     $this->assertRegExp('/(Emergency|Critical): ' . $testMessage . '/', $contents);
     $this->assertFileNotExists(LOGS . 'debug.log');
     $this->_deleteLogs();
     $testMessage = 'alert message';
     Log::alert($testMessage);
     $contents = file_get_contents(LOGS . 'error.log');
     $this->assertRegExp('/(Alert|Critical): ' . $testMessage . '/', $contents);
     $this->assertFileNotExists(LOGS . 'debug.log');
     $this->_deleteLogs();
     $testMessage = 'critical message';
     Log::critical($testMessage);
     $contents = file_get_contents(LOGS . 'error.log');
     $this->assertContains('Critical: ' . $testMessage, $contents);
     $this->assertFileNotExists(LOGS . 'debug.log');
     $this->_deleteLogs();
     $testMessage = 'error message';
     Log::error($testMessage);
     $contents = file_get_contents(LOGS . 'error.log');
     $this->assertContains('Error: ' . $testMessage, $contents);
     $this->assertFileNotExists(LOGS . 'debug.log');
     $this->_deleteLogs();
     $testMessage = 'warning message';
     Log::warning($testMessage);
     $contents = file_get_contents(LOGS . 'error.log');
     $this->assertContains('Warning: ' . $testMessage, $contents);
     $this->assertFileNotExists(LOGS . 'debug.log');
     $this->_deleteLogs();
     $testMessage = 'notice message';
     Log::notice($testMessage);
     $contents = file_get_contents(LOGS . 'debug.log');
     $this->assertRegExp('/(Notice|Debug): ' . $testMessage . '/', $contents);
     $this->assertFileNotExists(LOGS . 'error.log');
     $this->_deleteLogs();
     $testMessage = 'info message';
     Log::info($testMessage);
     $contents = file_get_contents(LOGS . 'debug.log');
     $this->assertRegExp('/(Info|Debug): ' . $testMessage . '/', $contents);
     $this->assertFileNotExists(LOGS . 'error.log');
     $this->_deleteLogs();
     $testMessage = 'debug message';
     Log::debug($testMessage);
     $contents = file_get_contents(LOGS . 'debug.log');
     $this->assertContains('Debug: ' . $testMessage, $contents);
     $this->assertFileNotExists(LOGS . 'error.log');
     $this->_deleteLogs();
 }
開發者ID:maitrepylos,項目名稱:nazeweb,代碼行數:57,代碼來源:LogTest.php

示例15: testCreateLoggerWithCallable

 /**
  * Tests using a callable for creating a Log engine
  *
  * @return void
  */
 public function testCreateLoggerWithCallable()
 {
     $instance = new FileLog();
     Log::config('default', function () use($instance) {
         return $instance;
     });
     $this->assertSame($instance, Log::engine('default'));
 }
開發者ID:Slayug,項目名稱:castor,代碼行數:13,代碼來源:LogTest.php


注:本文中的Cake\Log\Log::config方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。