Esempio n. 1
0
 /**
  * Debug function to catch warnings as exceptions
  */
 protected function bindWarningAsExceptions()
 {
     if ($this->config->getDebugMode()) {
         Logger::log('Added handlers for errors');
         //Warning & Notice handler
         set_error_handler(function ($errno, $errstr, $errfile, $errline) {
             Logger::log($errstr, LOG_CRIT, ['file' => $errfile, 'line' => $errline]);
             throw new \Exception($errstr, 500);
         });
     }
 }
Esempio n. 2
0
 /**
  * Método que inicializa el Logger
  * @param Config $config
  * @param array $args
  *
  * @return array
  */
 private function setup(Config $config, array $args = array())
 {
     $debug = $config->getDebugMode();
     $namespace = self::DEFAULT_NAMESPACE;
     if (0 !== count($args)) {
         if (array_key_exists(0, $args) && array_key_exists(0, $args[0])) {
             $namespace = $args[0][0];
         }
         if (array_key_exists(0, $args) && array_key_exists(1, $args[0])) {
             $debug = $args[0][1];
         }
     }
     $path = $this->createLoggerPath($config);
     return array($this->cleanLoggerName($namespace), $debug, $path);
 }