Skip to content

Commit

Permalink
Remove request and model from logging
Browse files Browse the repository at this point in the history
Removed as the better approach is to use a process specific to
SilverStripe
  • Loading branch information
camspiers committed Nov 25, 2013
1 parent f5ce3ce commit a4a5ad1
Showing 1 changed file with 4 additions and 29 deletions.
33 changes: 4 additions & 29 deletions src/Camspiers/LoggerBridge/LoggerBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,6 @@ class LoggerBridge implements \RequestFilter
*/
protected $exceptionHandler;

/**
* @var \SS_HTTPRequest
*/
protected $request;

/**
* @var \DataModel
*/
protected $model;

/**
* @var bool
*/
Expand Down Expand Up @@ -300,7 +290,7 @@ public function preRequest(
\Session $session,
\DataModel $model
) {
$this->registerGlobalHandlers($request, $model);
$this->registerGlobalHandlers();

return true;
}
Expand All @@ -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
Expand All @@ -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 () { }
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand All @@ -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)) {
Expand Down

0 comments on commit a4a5ad1

Please sign in to comment.