/**
  * Processes log messages and sends them to specific destination.	 *
  * @param array list of messages.	Each array elements represents one message
  * with the following structure:
  * array(
  *	 [0] => message (string)
  *	 [1] => level (string)
  *	 [2] => category (string)
  *	 [3] => timestamp (float, obtained by microtime(true));
  */
 protected function processLogs($logs)
 {
     foreach ($logs as $log) {
         if (is_scalar($log[0])) {
             if ($log[1] == 'info') {
                 PhpConsole::debug($log[0], $log[2]);
             } elseif ($log[1] == 'warning' || $log[1] == 'error') {
                 PhpConsole::debug($log[0], 'error,' . $log[2]);
             }
         }
     }
     return true;
 }
示例#2
0
function debug($message, $tags = 'debug')
{
    if (ENVIRONMENT != 'production') {
        PhpConsole::debug($message, $tags);
    }
}
示例#3
0
function debug($message, $tags = 'debug')
{
    PhpConsole::debug($message, $tags);
}
<?php

require_once __DIR__ . '/../../src/PhpConsole/__autoload.php';
\PhpConsole\OldVersionAdapter::register();
// register PhpConsole class emulator
// Call old PhpConsole v1 methods as is
PhpConsole::start(true, true, $_SERVER['DOCUMENT_ROOT']);
PhpConsole::debug('Debug using old method PhpConsole::debug()', 'some,tags');
debug('Debug using old function debug()', 'some,tags');
echo $undefinedVar;
PhpConsole::getInstance()->handleException(new Exception('test'));
// Call new PhpConsole methods, if you need :)
\PhpConsole\Connector::getInstance()->setServerEncoding('cp1251');
\PhpConsole\Helper::register();
PC::debug('Debug using new methods');
echo 'So there is an easy way to migrate from PhpConsole v1.x to v3.x without any code changes';