From a4a5ad1d12527fa8a85eecd1536956f9d9a0223e Mon Sep 17 00:00:00 2001 From: Cam Spiers Date: Mon, 25 Nov 2013 15:31:24 +1300 Subject: [PATCH] Remove request and model from logging Removed as the better approach is to use a process specific to SilverStripe --- src/Camspiers/LoggerBridge/LoggerBridge.php | 33 +++------------------ 1 file changed, 4 insertions(+), 29 deletions(-) diff --git a/src/Camspiers/LoggerBridge/LoggerBridge.php b/src/Camspiers/LoggerBridge/LoggerBridge.php index accffca..0b41707 100644 --- a/src/Camspiers/LoggerBridge/LoggerBridge.php +++ b/src/Camspiers/LoggerBridge/LoggerBridge.php @@ -70,16 +70,6 @@ class LoggerBridge implements \RequestFilter */ protected $exceptionHandler; - /** - * @var \SS_HTTPRequest - */ - protected $request; - - /** - * @var \DataModel - */ - protected $model; - /** * @var bool */ @@ -300,7 +290,7 @@ public function preRequest( \Session $session, \DataModel $model ) { - $this->registerGlobalHandlers($request, $model); + $this->registerGlobalHandlers(); return true; } @@ -325,17 +315,9 @@ public function postRequest( /** * Registers global error handlers - * @param \SS_HTTPRequest $request - * @param \DataModel $model */ - public function registerGlobalHandlers( - \SS_HTTPRequest $request = null, - \DataModel $model = null - ) { + public function registerGlobalHandlers() { if (!$this->registered) { - // Store the request and model for use in reporting - $this->request = $request; - $this->model = $model; // Store the previous error handler if there was any $this->registerErrorHandler(); // Store the previous exception handler if there was any @@ -360,8 +342,6 @@ public function registerGlobalHandlers( public function deregisterGlobalHandlers() { if ($this->registered) { - $this->request = null; - $this->model = null; // Restore the previous error handler if available set_error_handler( is_callable($this->errorHandler) ? $this->errorHandler : function () { } @@ -418,9 +398,7 @@ public function errorHandler($errno, $errstr, $errfile, $errline) // Log all errors regardless of type $context = array( 'file' => $errfile, - 'line' => $errline, - 'request' => $this->format($this->request), - 'model' => $this->format($this->model) + 'line' => $errline ); if ($this->reportBacktrace) { @@ -463,9 +441,7 @@ public function exceptionHandler(\Exception $exception) { $context = array( 'file' => $exception->getFile(), - 'line' => $exception->getLine(), - 'request' => $this->format($this->request), - 'model' => $this->format($this->model) + 'line' => $exception->getLine() ); if ($this->reportBacktrace) { @@ -491,7 +467,6 @@ public function exceptionHandler(\Exception $exception) public function fatalHandler() { $error = $this->getLastError(); - if ($this->isRegistered() && $this->isFatalError($error)) { if ($this->isMemoryExhaustedError($error)) {