/** * Handle exceptions * * This is the global Exception handler that will catch uncaught exceptions * and display a nice-looking page with details about the exception. * * @param Exception $e * @return void */ public static function handleExceptions( Exception $e ) { if ( $e instanceof Slim_Exception_Stop === false ) { Slim_Log::error($e); if ( self::config('debug') === true ) { self::halt(500, self::generateErrorMarkup($e->getMessage(), $e->getFile(), $e->getLine(), $e->getTraceAsString())); } else { self::error(); } } die(); }
/** * Test Log adapter methods if no logger set * * Pre-conditions * Log instantiated without associated Logger * * Post-conditions: * All Log adapter methods return false */ public function testLoggerMethodsIfNoLogger() { $log = new Slim_Log(); $this->assertFalse($log->debug('Test')); $this->assertFalse($log->info('Test')); $this->assertFalse($log->warn('Test')); $this->assertFalse($log->error('Test')); $this->assertFalse($log->fatal('Test')); }
public function testLogErrorExcludedByLevel() { $log = new Slim_Log(new MyWriter()); $log->setLevel(0); $this->assertFalse($log->error('Error')); }
/** * Test Log adapter methods if no logger set * * Pre-conditions * Logger not set * * Post-conditions: * All calls to adapter return false */ public function testLoggerMethodsIfNoLogger() { Slim_Log::setLogger(null); $this->assertFalse(Slim_Log::debug('Test')); $this->assertFalse(Slim_Log::info('Test')); $this->assertFalse(Slim_Log::warn('Test')); $this->assertFalse(Slim_Log::error('Test')); $this->assertFalse(Slim_Log::fatal('Test')); }