Пример #1
0
 /**
  * Creates an entry in the log file. The log entry will contain a stack trace from where it was called.
  * as well as export the variable using exportVar. By default the log is written to the debug log.
  *
  * @param mixed $var Variable or content to log.
  * @param int|string $level Type of log to use. Defaults to 'debug'.
  * @param int $depth The depth to output to. Defaults to 3.
  * @return void
  */
 public static function log($var, $level = 'debug', $depth = 3)
 {
     $source = static::trace(['start' => 1]) . "\n";
     Logger::getInstance()->write($level, "\n" . $source . static::exportVar($var, $depth));
 }
Пример #2
0
 /**
  * Handles exception logging
  *
  * @param \Exception $exception Exception instance.
  * @return bool
  */
 protected function _logException(Exception $exception)
 {
     $config = Configuration::getInstance();
     $unwrapped = $exception instanceof PHP7ErrorException ? $exception->getError() : $exception;
     if ($config->get("Error/logException", true) == false) {
         return false;
     }
     $skipped = $config->get('Error/skipLogFor', []);
     if (!empty($skipped)) {
         foreach ((array) $skipped as $class) {
             if ($unwrapped instanceof $class) {
                 return false;
             }
         }
     }
     return Logger::getInstance()->error($this->_getMessage($exception));
 }
Пример #3
0
 /**
  * Wrapper function for the logger object, useful for unit testing
  * or for overriding in subclasses.
  *
  * @param LoggedQuery $query to be written in log
  * @return void
  */
 protected function _log($query)
 {
     Logger::getInstance()->write('debug', $query, ['queriesLog']);
 }