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


PHP Log::engine方法代码示例

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


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

示例1: main

 /**
  * Override main() to handle action
  * Starts a Queuesadilla worker
  *
  * @return void
  */
 public function main()
 {
     $logger = Log::engine($this->getLoggerName('stdout'));
     $engine = $this->getEngine($logger);
     $worker = $this->getWorker($engine, $logger);
     $worker->work();
 }
开发者ID:josegonzalez,项目名称:cakephp-queuesadilla,代码行数:13,代码来源:QueuesadillaShell.php

示例2: summary

 /**
  * Get the summary data.
  *
  * @return string
  */
 public function summary()
 {
     $logger = Log::engine('debug_kit_log_panel');
     if (!$logger) {
         return 0;
     }
     return $logger->count();
 }
开发者ID:jeremyharris,项目名称:debug_kit,代码行数:13,代码来源:LogPanel.php

示例3: main

 /**
  * Override main() to handle action
  * Starts a Queuesadilla worker
  *
  * @return void
  */
 public function main()
 {
     $engine = $this->params['engine'];
     $worker = $this->params['worker'];
     $EngineClass = "josegonzalez\\Queuesadilla\\Engine\\" . $engine . 'Engine';
     $WorkerClass = "josegonzalez\\Queuesadilla\\Worker\\" . $worker . "Worker";
     $config = $this->getEngineConfig();
     $loggerName = $this->getLoggerName();
     $logger = Log::engine($loggerName);
     $engine = new $EngineClass($logger, $config);
     $worker = new $WorkerClass($engine, $logger);
     $worker->work();
 }
开发者ID:themogwi,项目名称:app,代码行数:19,代码来源:QueuesadillaShell.php

示例4: _create

 /**
  * Create the queue engine instance.
  *
  * Part of the template method for Cake\Core\ObjectRegistry::load()
  *
  * @param string|\josegonzalez\Queuesadilla\Engine\EngineInterface $class The classname or object to make.
  * @param string $alias The alias of the object.
  * @param array $settings An array of settings to use for the queue engine.
  * @return \josegonzalez\Queuesadilla\Engine\EngineInterface The constructed queue engine class.
  * @throws \RuntimeException when an object doesn't implement the correct interface.
  */
 protected function _create($class, $alias, $settings)
 {
     if (is_callable($class)) {
         $class = $class($alias);
     }
     if (is_object($class)) {
         $instance = $class;
     }
     if (!isset($instance)) {
         $key = PHP_SAPI === 'cli' ? 'stdout' : 'default';
         $logger = Hash::get($settings, 'logger', $key);
         if (!$logger instanceof LoggerInterface) {
             $logger = Log::engine($logger);
         }
         $instance = new $class($logger, $settings);
     }
     if ($instance instanceof EngineInterface) {
         return $instance;
     }
     throw new RuntimeException('Queue Engines must implement josegonzalez\\Queuesadilla\\Engine\\EngineInterface.');
 }
开发者ID:cleptric,项目名称:cakephp-queuesadilla,代码行数:32,代码来源:QueueEngineRegistry.php

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

示例6: testSetLoggersVerbose

 /**
  * Tests that setLoggers works properly with verbose
  *
  * @return void
  */
 public function testSetLoggersVerbose()
 {
     Log::drop('stdout');
     Log::drop('stderr');
     $this->io->setLoggers(ConsoleIo::VERBOSE);
     $this->assertNotEmpty(Log::engine('stderr'));
     $engine = Log::engine('stdout');
     $this->assertEquals(['notice', 'info', 'debug'], $engine->config('levels'));
 }
开发者ID:rashmi,项目名称:newrepo,代码行数:14,代码来源:ConsoleIoTest.php

示例7: testLogFunction

 /**
  * Tests that the logged query object is passed to the built-in logger using
  * the correct scope
  *
  * @return void
  */
 public function testLogFunction()
 {
     $logger = new QueryLogger();
     $query = new LoggedQuery();
     $query->query = 'SELECT a FROM b where a = ? AND b = ? AND c = ?';
     $query->params = ['string', '3', null];
     $engine = $this->getMock('\\Cake\\Log\\Engine\\BaseLog', ['log'], ['scopes' => ['queriesLog']]);
     Log::engine('queryLoggerTest', $engine);
     $engine2 = $this->getMock('\\Cake\\Log\\Engine\\BaseLog', ['log'], ['scopes' => ['foo']]);
     Log::engine('queryLoggerTest2', $engine2);
     $engine2->expects($this->never())->method('log');
     $logger->log($query);
 }
开发者ID:JesseDarellMoore,项目名称:CS499,代码行数:19,代码来源:QueryLoggerTest.php

示例8: testSetLoggers

 /**
  * Tests that setLoggers works properly
  *
  * @return void
  */
 public function testSetLoggers()
 {
     Log::drop('stdout');
     Log::drop('stderr');
     $this->io->setLoggers(true);
     $this->assertNotEmpty(Log::engine('stdout'));
     $this->assertNotEmpty(Log::engine('stderr'));
     $this->io->setLoggers(false);
     $this->assertFalse(Log::engine('stdout'));
     $this->assertFalse(Log::engine('stderr'));
 }
开发者ID:alexunique0519,项目名称:Blog_Cakephp_association,代码行数:16,代码来源:ConsoleIoTest.php

示例9: _log

 /**
  * Log requests to Elastic Search.
  *
  * @param Request|array $context The context of the request made.
  * @return void
  */
 protected function _log($context)
 {
     if (!$this->logQueries) {
         return;
     }
     if (!isset($this->_logger)) {
         $this->_logger = Log::engine('elasticsearch') ?: new ElasticaLog();
     }
     if ($context instanceof Request) {
         $data = $context->toArray();
     } else {
         $data = ['message' => $context];
     }
     $logData = ['method' => $data['method'], 'path' => $data['path'], 'data' => $data['data']];
     $data = json_encode($logData, JSON_PRETTY_PRINT);
     $loggedQuery = new LoggedQuery();
     $loggedQuery->query = $data;
     if ($this->_logger instanceof \Psr\Log\LoggerInterface) {
         $this->_logger->log('debug', $loggedQuery);
     } else {
         $this->_logger->log($loggedQuery);
     }
 }
开发者ID:cakephp,项目名称:elastic-search,代码行数:29,代码来源:Connection.php

示例10: testPassingScopeToEngine

 /**
  * testPassingScopeToEngine method
  */
 public function testPassingScopeToEngine()
 {
     Configure::write('App.namespace', 'TestApp');
     Log::reset();
     Log::config('scope_test', ['engine' => 'TestApp', 'types' => array('notice', 'info', 'debug'), 'scopes' => array('foo', 'bar')]);
     $engine = Log::engine('scope_test');
     $this->assertNull($engine->passedScope);
     Log::write('debug', 'test message', 'foo');
     $this->assertEquals(['scope' => ['foo']], $engine->passedScope);
     Log::write('debug', 'test message', ['foo', 'bar']);
     $this->assertEquals(['scope' => ['foo', 'bar']], $engine->passedScope);
     $result = Log::write('debug', 'test message');
     $this->assertFalse($result);
 }
开发者ID:maitrepylos,项目名称:nazeweb,代码行数:17,代码来源:LogTest.php


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