本文整理汇总了PHP中Cake\Log\Log::drop方法的典型用法代码示例。如果您正苦于以下问题:PHP Log::drop方法的具体用法?PHP Log::drop怎么用?PHP Log::drop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cake\Log\Log
的用法示例。
在下文中一共展示了Log::drop方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
/**
* setup, create mocks
*
* @return Mock object
*/
public function setUp()
{
parent::setUp();
$this->stderr = $this->getMock('Cake\\Console\\ConsoleOutput', [], [], '', false);
$this->Error = $this->getMock('Cake\\Console\\ConsoleErrorHandler', ['_stop'], [['stderr' => $this->stderr]]);
Log::drop('stderr');
}
示例2: setUp
/**
* setup, create mocks
*
* @return void
*/
public function setUp()
{
parent::setUp();
$this->stderr = $this->getMockBuilder('Cake\\Console\\ConsoleOutput')->disableOriginalConstructor()->getMock();
$this->Error = $this->getMockBuilder('Cake\\Console\\ConsoleErrorHandler')->setMethods(['_stop'])->setConstructorArgs([['stderr' => $this->stderr]])->getMock();
Log::drop('stderr');
}
示例3: main
/**
* Start the shell and interactive console.
*
* @return int|void
*/
public function main()
{
if (!class_exists('Psy\\Shell')) {
$this->err('<error>Unable to load Psy\\Shell.</error>');
$this->err('');
$this->err('Make sure you have installed psysh as a dependency,');
$this->err('and that Psy\\Shell is registered in your autoloader.');
$this->err('');
$this->err('If you are using composer run');
$this->err('');
$this->err('<info>$ php composer.phar require --dev psy/psysh</info>');
$this->err('');
return 1;
}
$this->out("You can exit with <info>`CTRL-C`</info> or <info>`exit`</info>");
$this->out('');
Log::drop('debug');
Log::drop('error');
$this->_io->setLoggers(false);
restore_error_handler();
restore_exception_handler();
$psy = new PsyShell();
$psy->run();
return 0;
}
示例4: main
/**
* Start the shell and interactive console.
*
* @return void
*/
public function main()
{
if (!class_exists('Boris\\Boris')) {
$this->err('<error>Unable to load Boris\\Boris.</error>');
$this->err('');
$this->err('Make sure you have installed boris as a dependency,');
$this->err('and that Boris\\Boris is registered in your autoloader.');
$this->err('');
$this->err('If you are using composer run');
$this->err('');
$this->err('<info>$ php composer.phar require d11wtq/boris</info>');
$this->err('');
return 1;
}
if (!function_exists('pcntl_signal')) {
$this->err('<error>No process control functions.</error>');
$this->err('');
$this->err('You are missing the pcntl extension, the interactive console requires this extension.');
return 2;
}
$this->out('You can exit with <info>CTRL-D</info>');
Log::drop('debug');
Log::drop('error');
$this->_io->setLoggers(false);
restore_error_handler();
restore_exception_handler();
$boris = new Boris('app > ');
$boris->start();
}
示例5: tearDown
/**
* tearDown method
*
* @return void
*/
public function tearDown()
{
parent::tearDown();
Log::drop('email');
Email::drop('test');
Email::dropTransport('debug');
Email::dropTransport('test_smtp');
}
示例6: main
/**
* Start the shell and interactive console.
*
* @return void
*/
public function main()
{
if (!class_exists('Boris\\Boris')) {
$this->err('<error>Unable to load Boris\\Boris.</error>');
$this->err('');
$this->err('Make sure you have installed boris as a dependency,');
$this->err('and that Boris\\Boris is registered in your autoloader.');
$this->err('');
$this->err('If you are using composer run');
$this->err('');
$this->err('<info>$ php composer.phar require d11wtq/boris</info>');
$this->err('');
return 1;
}
$this->out('You can exit with <info>CTRL-D</info>');
Log::drop('debug');
Log::drop('error');
restore_error_handler();
restore_exception_handler();
$boris = new Boris('app > ');
$boris->start();
}
示例7: testWriteUnhandled
/**
* Test that write() returns false on an unhandled message.
*
* @return void
*/
public function testWriteUnhandled()
{
Log::drop('error');
Log::drop('debug');
$result = Log::write('error', 'Bad stuff', 'unpossible');
$this->assertFalse($result);
}
示例8: setLoggers
/**
* Connects or disconnects the loggers to the console output.
*
* Used to enable or disable logging stream output to stdout and stderr
* If you don't wish all log output in stdout or stderr
* through Cake's Log class, call this function with `$enable=false`.
*
* @param int|bool $enable Use a boolean to enable/toggle all logging. Use
* one of the verbosity constants (self::VERBOSE, self::QUIET, self::NORMAL)
* to control logging levels. VERBOSE enables debug logs, NORMAL does not include debug logs,
* QUIET disables notice, info and debug logs.
* @return void
*/
public function setLoggers($enable)
{
Log::drop('stdout');
Log::drop('stderr');
if ($enable === false) {
return;
}
$outLevels = ['notice', 'info'];
if ($enable === static::VERBOSE || $enable === true) {
$outLevels[] = 'debug';
}
if ($enable !== static::QUIET) {
$stdout = new ConsoleLog(['types' => $outLevels, 'stream' => $this->_out]);
Log::config('stdout', ['engine' => $stdout]);
}
$stderr = new ConsoleLog(['types' => ['emergency', 'alert', 'critical', 'error', 'warning'], 'stream' => $this->_err]);
Log::config('stderr', ['engine' => $stderr]);
}
示例9: 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'));
}
示例10: 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'));
}
示例11: setLoggers
/**
* Connects or disconnects the loggers to the console output.
*
* Used to enable or disable logging stream output to stdout and stderr
* If you don't wish all log output in stdout or stderr
* through Cake's Log class, call this function with `$enable=false`.
*
* @param bool $enable Whether you want loggers on or off.
* @return void
*/
public function setLoggers($enable)
{
Log::drop('stdout');
Log::drop('stderr');
if (!$enable) {
return;
}
$stdout = new ConsoleLog(['types' => ['notice', 'info', 'debug'], 'stream' => $this->_out]);
Log::config('stdout', ['engine' => $stdout]);
$stderr = new ConsoleLog(['types' => ['emergency', 'alert', 'critical', 'error', 'warning'], 'stream' => $this->_err]);
Log::config('stderr', ['engine' => $stderr]);
}
示例12: tearDown
public function tearDown()
{
parent::tearDown();
Log::drop('trait_test');
}
示例13: tearDown
/**
* Teardown method.
*
* @return void
*/
public function tearDown()
{
parent::tearDown();
Log::drop('debug_kit_log_panel');
}
示例14: testLog
/**
* testLog method
*
* @return void
*/
public function testLog()
{
$mock = $this->getMock('Cake\\Log\\Engine\\BaseLog', ['log']);
Log::config('test', ['engine' => $mock]);
$mock->expects($this->at(0))->method('log')->with('debug', $this->logicalAnd($this->stringContains('DebuggerTest::testLog'), $this->stringContains('cool')));
$mock->expects($this->at(1))->method('log')->with('debug', $this->logicalAnd($this->stringContains('DebuggerTest::testLog'), $this->stringContains('[main]'), $this->stringContains("'whatever',"), $this->stringContains("'here'")));
Debugger::log('cool');
Debugger::log(['whatever', 'here']);
Log::drop('test');
}
示例15: function
* Connect middleware/dispatcher filters.
*/
DispatcherFactory::add('Asset');
DispatcherFactory::add('Routing');
DispatcherFactory::add('ControllerFactory');
/**
* Cakebox: use Monolog to create a combined log (with all log levels) to enable
* Logstash > Elasticsearch forwarding, unless we are in CLI mode which defines
* it's own Monlog logger (with 'cli' prefix tag instead of 'app').
*
* Notes:
* - will log to /var/logs/cakephp if available so it can be parsed by Logstash
* - LogStashFormatter argument is used as Logstash/Elasticsearch "type"
* - Logger second argument is used as Monolog "channel"
*/
if (!$isCli) {
Log::config('default', function () {
if (is_writable('/var/log/cakephp')) {
$handler = new StreamHandler('/var/log/cakephp/cakebox.log');
} else {
$handler = new StreamHandler(LOGS . DS . 'cakebox.log');
}
$formatter = new LogstashFormatter('cakephp');
$handler->setFormatter($formatter);
$log = new Logger('app.cakebox', array($handler));
return $log;
});
// Stop using the now redundant default CakePHP file loggers
Log::drop('debug');
Log::drop('error');
}