Exemple #1
0
 /**
  * Initiates the Logger.
  *
  * Registers the error and exception handler, when required to do so by configuration
  */
 public function __construct()
 {
     // Register the error handler, Untestable
     // @codeCoverageIgnoreStart
     if (Config::get('error')->error_reporting == true && self::$useTracy === false) {
         set_error_handler(array('\\FuzeWorks\\Logger', 'errorHandler'), E_ALL);
         set_Exception_handler(array('\\FuzeWorks\\Logger', 'exceptionHandler'));
     }
     // @codeCoverageIgnoreEnd
     error_reporting(false);
     self::$debug = ENVIRONMENT === 'DEVELOPMENT';
     self::$log_to_file = Config::get('error')->log_to_file;
     self::$logger_template = Config::get('error')->logger_template;
     self::newLevel('Logger Initiated');
     if (self::$useTracy) {
         LoggerTracyBridge::register();
     }
 }
 /**
  * Set exception and error handlers
  * @link http://php.net/manual/en/function.set-error-handler.php
  * @return boolean
  */
 public static function setHandlers()
 {
     /*
     The following error types cannot be handled with a 
     user defined function: E_ERROR, E_PARSE, E_CORE_ERROR, 
     E_CORE_WARNING, E_COMPILE_ERROR, E_COMPILE_WARNING, 
     and most of E_STRICT raised in the file where set_error_handler() is called.
     */
     error_reporting(E_ALL ^ E_DEPRECATED | E_ERROR | E_PARSE | E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_COMPILE_WARNING | E_STRICT);
     set_Exception_handler(array(get_class(), 'ExceptionHandler'));
     set_error_handler(array(get_class(), "errorHandler"));
     return true;
 }