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


PHP CakeLog::config方法代碼示例

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


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

示例1: setUp

 /**
  * Sets up a mocked logger stream
  *
  * @return void
  **/
 public function setUp()
 {
     parent::setUp();
     $class = $this->getMockClass('BaseLog');
     CakeLog::config('queuetest', array('engine' => $class, 'types' => array('error'), 'scopes' => ['gearman']));
     $this->logger = CakeLog::stream('queuetest');
     Configure::write('Gearman', array());
 }
開發者ID:lorenzo,項目名稱:cakephp-gearman,代碼行數:13,代碼來源:GearmanQueueTest.php

示例2: setUp

 /**
  * Sets up a mocked logger stream
  *
  * @return void
  **/
 public function setUp()
 {
     parent::setUp();
     $this->_root = Nodes\Environment::getRoot();
     Nodes\Environment::setRoot('/var/www/test');
     $class = $this->getMockClass('BaseLog');
     CakeLog::config('queuetest', array('engine' => $class, 'types' => array('error')));
     $this->logger = CakeLog::stream('queuetest');
 }
開發者ID:nodesagency,項目名稱:Platform-Common-Plugin,代碼行數:14,代碼來源:GearmanQueueTest.php

示例3: setUp

 /**
  * Sets up a mocked logger stream
  *
  * @return void
  **/
 public function setUp()
 {
     parent::setUp();
     $class = $this->getMockClass('BaseLog', array('write'), array(), 'SQSBaseLog');
     CakeLog::config('queuetest', array('engine' => $class, 'types' => array('error', 'debug'), 'scopes' => array('sqs')));
     $this->logger = CakeLog::stream('queuetest');
     CakeLog::disable('stderr');
     Configure::write('SQS', array());
 }
開發者ID:dilab,項目名稱:cakephp-sqs,代碼行數:14,代碼來源:SimpleQueueTest.php

示例4: __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

示例5: setUp

	public function setUp() {
		parent::setUp();
		CakeLog::config('debug', array(
			'engine' => 'FileLog',
			'types' => array('notice', 'info', 'debug'),
			'file' => 'debug',
		));
		CakeLog::config('error', array(
			'engine' => 'FileLog',
			'types' => array('error', 'warning'),
			'file' => 'error',
		));
	}
開發者ID:hungnt88,項目名稱:5stars-1,代碼行數:13,代碼來源:ConsoleLogTest.php

示例6: testLog

 public function testLog()
 {
     $stream = CakeLog::stream('error');
     $engine = get_class($stream);
     $config = array_merge($stream->config(), compact('engine'));
     CakeLog::config('error', array_merge($config, array('engine' => 'FileLog', 'path' => TMP . 'tests' . DS)));
     $filepath = TMP . 'tests' . DS . 'error.log';
     if (file_exists($filepath)) {
         unlink($filepath);
     }
     $this->assertTrue($this->Model->log('Test warning 1'));
     $this->assertTrue($this->Model->log(array('Test' => 'warning 2')));
     $result = file($filepath);
     $this->assertRegExp('/^2[0-9]{3}-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+ Error: Test warning 1$/', $result[0]);
     $this->assertRegExp('/^2[0-9]{3}-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+ Error: Array$/', $result[1]);
     $this->assertRegExp('/^\\($/', $result[2]);
     $this->assertRegExp('/\\[Test\\] => warning 2$/', $result[3]);
     $this->assertRegExp('/^\\)$/', $result[4]);
     unlink($filepath);
     $this->assertTrue($this->Model->log('Test warning 1', LOG_WARNING));
     $this->assertTrue($this->Model->log(array('Test' => 'warning 2'), LOG_WARNING));
     $result = file($filepath);
     $this->assertRegExp('/^2[0-9]{3}-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+ Warning: Test warning 1$/', $result[0]);
     $this->assertRegExp('/^2[0-9]{3}-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+ Warning: Array$/', $result[1]);
     $this->assertRegExp('/^\\($/', $result[2]);
     $this->assertRegExp('/\\[Test\\] => warning 2$/', $result[3]);
     $this->assertRegExp('/^\\)$/', $result[4]);
     unlink($filepath);
     CakeLog::config('error', array_merge($config, array('engine' => 'FileLog', 'path' => TMP . 'tests' . DS, 'scopes' => array('some_scope'))));
     $this->assertTrue($this->Model->log('Test warning 1', LOG_WARNING));
     $this->assertTrue(!file_exists($filepath));
     $this->assertTrue($this->Model->log('Test warning 1', LOG_WARNING, 'some_scope'));
     $result = file($filepath);
     $this->assertRegExp('/^2[0-9]{3}-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+ Warning: Test warning 1$/', $result[0]);
     CakeLog::config('error', $config);
 }
開發者ID:gourmet,項目名稱:common,代碼行數:36,代碼來源:CommonAppModelTest.php

示例7: testLogDepth

 /**
  * test log() depth
  *
  * @return void
  */
 public function testLogDepth()
 {
     if (file_exists(LOGS . 'debug.log')) {
         unlink(LOGS . 'debug.log');
     }
     CakeLog::config('file', array('engine' => 'File', 'path' => TMP . 'logs' . DS));
     $val = array('test' => array('key' => 'val'));
     Debugger::log($val, LOG_DEBUG, 0);
     $result = file_get_contents(LOGS . 'debug.log');
     $this->assertContains('DebuggerTest::testLog', $result);
     $this->assertNotContains("/'val'/", $result);
     unlink(LOGS . 'debug.log');
 }
開發者ID:hupla78,項目名稱:Nadia,代碼行數:18,代碼來源:DebuggerTest.php

示例8: array

/**
 * Configure the cache handlers that CakePHP will use for internal
 * metadata like class maps, and model schema.
 *
 * By default File is used, but for improved performance you should use APC.
 *
 * Note: 'default' and other application caches should be configured in app/Config/bootstrap.php.
 *       Please check the comments in bootstrap.php for more info on the cache engines available
 *       and their settings.
 */
$engine = 'File';
// In development mode, caches should expire quickly.
$duration = '+999 days';
if (Configure::read('debug') > 0) {
    $duration = '+10 seconds';
}
// Prefix each application on the same server with a different string, to avoid Memcache and APC conflicts.
$prefix = 'site_';
App::uses('CakeLog', 'Log');
CakeLog::config('default', array('engine' => 'FileLog'));
/**
 * Configure the cache used for general framework caching. Path information,
 * object listings, and translation cache files are stored with this configuration.
 */
Cache::config('_cake_core_', array('engine' => $engine, 'prefix' => $prefix . 'cake_core_', 'path' => CACHE . 'persistent' . DS, 'serialize' => $engine === 'File', 'duration' => $duration));
/**
 * Configure the cache for model and datasource caches. This cache configuration
 * is used to store schema descriptions, and table listings in connections.
 */
Cache::config('_cake_model_', array('engine' => $engine, 'prefix' => $prefix . 'cake_model_', 'path' => CACHE . 'models' . DS, 'serialize' => $engine === 'File', 'duration' => $duration));
Cache::config('default', array('engine' => $engine, 'serialize' => $engine === 'File', 'duration' => 31 * DAY));
開發者ID:dereuromark,項目名稱:cakephp-sandbox,代碼行數:31,代碼來源:core.php

示例9: array

 * Configure::write('I18n.preferApp', true);
 */
/**
 * You can attach event listeners to the request lifecycle as Dispatcher Filter. By default CakePHP bundles two filters:
 *
 * - AssetDispatcher filter will serve your asset files (css, images, js, etc) from your themes and plugins
 * - CacheDispatcher filter will read the Cache.check configure variable and try to serve cached content generated from controllers
 *
 * Feel free to remove or add filters as you see fit for your application. A few examples:
 *
 * Configure::write('Dispatcher.filters', array(
 *		'MyCacheFilter', //  will use MyCacheFilter class from the Routing/Filter package in your app.
 *		'MyCacheFilter' => array('prefix' => 'my_cache_'), //  will use MyCacheFilter class from the Routing/Filter package in your app with settings array.
 *		'MyPlugin.MyFilter', // will use MyFilter class from the Routing/Filter package in MyPlugin plugin.
 *		array('callable' => $aFunction, 'on' => 'before', 'priority' => 9), // A valid PHP callback type to be called on beforeDispatch
 *		array('callable' => $anotherMethod, 'on' => 'after'), // A valid PHP callback type to be called on afterDispatch
 *
 * ));
 */
Configure::write('Dispatcher.filters', array('AssetDispatcher', 'CacheDispatcher'));
/**
 * Configures default file logging options
 */
App::uses('CakeLog', 'Log');
CakeLog::config('default', array('engine' => 'File'));
CakeLog::config('debug', array('engine' => 'File', 'types' => array('notice', 'info', 'debug'), 'file' => 'debug'));
CakeLog::config('error', array('engine' => 'File', 'types' => array('warning', 'error', 'critical', 'alert', 'emergency'), 'file' => 'error'));
CakeLog::config('payment', array('engine' => 'FileLog', 'types' => array('info', 'error', 'warning'), 'scopes' => array('payment'), 'file' => 'payment'));
CakePlugin::load('DebugKit');
CakePlugin::load('Upload');
CakePlugin::load('BoostCake');
開發者ID:sonnt1991,項目名稱:Goikenban,代碼行數:31,代碼來源:bootstrap.php

示例10: tearDown

 /**
  * Teardown
  */
 public function tearDown()
 {
     CakeLog::config('default', array('engine' => 'FileLog'));
     parent::tearDown();
 }
開發者ID:simaostephanie,項目名稱:CakePHP-DatabaseLog,代碼行數:8,代碼來源:DatabaseLogTest.php

示例11: shepherds

 public function shepherds()
 {
     CakeLog::config('sensor', array('engine' => 'FileLog', 'types' => array('warning', 'error', 'info'), 'scopes' => array('sensors'), 'file' => 'sensors.log'));
     $this->layout = 'ajax';
     if ($this->request->is('put')) {
         $this->logMe('PUT /pswn/shepherds');
         $return = '{"action":"updated"}';
     } else {
         if ($this->request->is('get')) {
             $this->logMe('GET /pswn/shepherds');
             $str = '';
             $return = '{"timeslice":"1/6","beacon_time":23,"bcc":120}';
         }
     }
     $this->response->type('json');
     $this->set('jsonResponse', $return);
 }
開發者ID:vinik,項目名稱:cosmic2,代碼行數:17,代碼來源:PswnController.php

示例12: array

	'file' => 'debug',
));*/
/*CakeLog::config('error', array(
	'engine' => 'File',
	'types' => array('warning', 'error', 'critical', 'alert', 'emergency'),
	'file' => 'error',
));*/
CakeLog::config('debug', Configure::read(APP_NAME . '.logging.debug'));
CakeLog::config('error', Configure::read(APP_NAME . '.logging.error'));
/*
 * Load plugins
 */
//CakePlugin::load('OrcaTools', array('bootstrap' => true));
CakePlugin::load('OrcaAppSetup');
CakePlugin::load('FakeSeeder');
CakePlugin::load('DebugKit');
CakePlugin::load('MultiColumnUniqueness');
//CakePlugin::load('ValidForeignKeyBehavior');
CakePlugin::load('Migrations');
CakePlugin::load('DatabaseLog');
CakePlugin::load('ClearCache');
// Load those plugins only when in debug mode
if (Configure::read('debug')) {
    CakePlugin::load('TestDataValidation');
}
/**
 * Setup additional logging
 */
if (Configure::check(APP_NAME . '.logging.database')) {
    CakeLog::config('default', Configure::read(APP_NAME . '.logging.database'));
}
開發者ID:steampilot,項目名稱:sp-clubmanager,代碼行數:31,代碼來源:bootstrap.php

示例13: testSendWithLogAndScope

 /**
  * testSendWithLogAndScope method
  *
  * @return void
  */
 public function testSendWithLogAndScope()
 {
     CakeLog::config('email', array('engine' => 'File', 'path' => TMP, 'types' => array('cake_test_emails'), 'scopes' => array('email')));
     CakeLog::drop('default');
     $this->CakeEmail->transport('Debug');
     $this->CakeEmail->to('me@cakephp.org');
     $this->CakeEmail->from('cake@cakephp.org');
     $this->CakeEmail->subject('My title');
     $this->CakeEmail->config(array('log' => array('level' => 'cake_test_emails', 'scope' => 'email')));
     $result = $this->CakeEmail->send("Logging This");
     App::uses('File', 'Utility');
     $File = new File(TMP . 'cake_test_emails.log');
     $log = $File->read();
     $this->assertTrue(strpos($log, $result['headers']) !== FALSE);
     $this->assertTrue(strpos($log, $result['message']) !== FALSE);
     $File->delete();
     CakeLog::drop('email');
 }
開發者ID:mrbadao,項目名稱:api-official,代碼行數:23,代碼來源:CakeEmailTest.php

示例14:

CakePlugin::load('Jcamp');
/**
 * To prefer app translation over plugin translation, you can set
 *
 * Configure::write('I18n.preferApp', true);
 */
/**
 * You can attach event listeners to the request lifecycle as Dispatcher Filter. By default CakePHP bundles two filters:
 *
 * - AssetDispatcher filter will serve your asset files (css, images, js, etc) from your themes and plugins
 * - CacheDispatcher filter will read the Cache.check configure variable and try to serve cached content generated from controllers
 *
 * Feel free to remove or add filters as you see fit for your application. A few examples:
 *
 * Configure::write('Dispatcher.filters', array(
 *		'MyCacheFilter', //  will use MyCacheFilter class from the Routing/Filter package in your app.
 *		'MyCacheFilter' => array('prefix' => 'my_cache_'), //  will use MyCacheFilter class from the Routing/Filter package in your app with settings array.
 *		'MyPlugin.MyFilter', // will use MyFilter class from the Routing/Filter package in MyPlugin plugin.
 *		array('callable' => $aFunction, 'on' => 'before', 'priority' => 9), // A valid PHP callback type to be called on beforeDispatch
 *		array('callable' => $anotherMethod, 'on' => 'after'), // A valid PHP callback type to be called on afterDispatch
 *
 * ));
 */
Configure::write('Dispatcher.filters', ['AssetDispatcher', 'CacheDispatcher']);
/**
 * Configures default file logging options
 */
App::uses('CakeLog', 'Log');
CakeLog::config('debug', ['engine' => 'File', 'types' => ['notice', 'info', 'debug'], 'file' => 'debug']);
CakeLog::config('error', ['engine' => 'File', 'types' => ['warning', 'error', 'critical', 'alert', 'emergency'], 'file' => 'error']);
開發者ID:egonw,項目名稱:OSDB,代碼行數:30,代碼來源:bootstrap.php

示例15: __construct

 /**
  * Constructs this Shell instance.
  *
  * @param ConsoleOutput $stdout
  *        	A ConsoleOutput object for stdout.
  * @param ConsoleOutput $stderr
  *        	A ConsoleOutput object for stderr.
  * @param ConsoleInput $stdin
  *        	A ConsoleInput object for stdin.
  * @link http://book.cakephp.org/2.0/en/console-and-shells.html#Shell
  */
 public function __construct($stdout = null, $stderr = null, $stdin = null)
 {
     if ($this->name == null) {
         $this->name = Inflector::camelize(str_replace(array('Shell', 'Task'), '', get_class($this)));
     }
     $this->Tasks = new TaskCollection($this);
     $this->stdout = $stdout;
     $this->stderr = $stderr;
     $this->stdin = $stdin;
     if ($this->stdout == null) {
         $this->stdout = new ConsoleOutput('php://stdout');
     }
     CakeLog::config('stdout', array('engine' => 'ConsoleLog', 'types' => array('notice', 'info'), 'stream' => $this->stdout));
     if ($this->stderr == null) {
         $this->stderr = new ConsoleOutput('php://stderr');
     }
     CakeLog::config('stderr', array('engine' => 'ConsoleLog', 'types' => array('emergency', 'alert', 'critical', 'error', 'warning', 'debug'), 'stream' => $this->stderr));
     if ($this->stdin == null) {
         $this->stdin = new ConsoleInput('php://stdin');
     }
     $parent = get_parent_class($this);
     if ($this->tasks !== null && $this->tasks !== false) {
         $this->_mergeVars(array('tasks'), $parent, true);
     }
     if ($this->uses !== null && $this->uses !== false) {
         $this->_mergeVars(array('uses'), $parent, false);
     }
 }
開發者ID:julkar9,項目名稱:gss,代碼行數:39,代碼來源:Shell.php


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