Odyssey
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
CatchHandler Class Reference
Inheritance diagram for CatchHandler:
CatchErrorHandler CatchExceptionHandler

Public Member Functions

 __construct ($pSetProduct, $pSetLogger=null)
 
 setLogger ($pLogger)
 
 setDevMode ($pDevMode)
 
 getDevMode ()
 
 setErrorReporting ($pNewReportLvl)
 
 getErrorReporting ()
 

Protected Member Functions

 handleError ()
 
 setSaveLog ($pSaveLog)
 
 getErrMsg ()
 
 setNotice ($pNoticeOnly)
 

Protected Attributes

 $errLogger = null
 
 $errReportLvl = E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED
 
 $errRemoteAddr
 
 $errRequestUri
 
 $errServerName
 
 $errPhpSelf
 
 $errScriptName
 
 $errQueryString
 

Private Member Functions

 SaveLogMsg ()
 

Private Attributes

 $saveLog = false
 
 $showErrPage = false
 
 $errPageUrl = ''
 
 $noticeOnly = false
 
 $hcuProduct = null
 
 $hcuDevMode = 0
 

Detailed Description

Definition at line 20 of file hcuLogError.i.

Constructor & Destructor Documentation

◆ __construct()

CatchHandler::__construct (   $pSetProduct,
  $pSetLogger = null 
)

PARENT CONSTRUCTOR

Set the logger object if it is defined

Definition at line 86 of file hcuLogError.i.

86  {
87 
88  $this->hcuProduct = $pSetProduct;
89 
90  /**
91  * Set the logger object if it is defined
92  */
93  $this->setLogger($pSetLogger);
94  $this->setErrorReporting($this->errReportLvl);
95 
96  }
setLogger($pLogger)
Definition: hcuLogError.i:173
setErrorReporting($pNewReportLvl)
Definition: hcuLogError.i:201

Member Function Documentation

◆ getErrorReporting()

CatchHandler::getErrorReporting ( )

Get the current level of php debugging

Returns
int the previous value of error reporting

Definition at line 213 of file hcuLogError.i.

213  {
214  return $this->errReportLvl;
215  }

◆ handleError()

CatchHandler::handleError ( )
protected

PROTECTED METHODS

Record the _SERVER variables

Definition at line 133 of file hcuLogError.i.

133  {
134 
135  /**
136  * Record the _SERVER variables
137  */
138 
139  $this->errRemoteAddr = (array_key_exists("REMOTE_ADDR", $_SERVER) ? $_SERVER['REMOTE_ADDR'] : '0.0.0.0');
140  $this->errRequestUri = (array_key_exists("REQUEST_URI", $_SERVER) ? $_SERVER['REQUEST_URI'] : '127.0.0.1');
141  $this->errServerName = (array_key_exists("SERVER_NAME", $_SERVER) ? $_SERVER['SERVER_NAME'] : '');
142  $this->errPhpSelf = (array_key_exists("PHP_SELF", $_SERVER) ? $_SERVER['PHP_SELF'] : '');
143  $this->errScriptFileName = (array_key_exists("SCRIPT_FILENAME", $_SERVER) ? $_SERVER['SCRIPT_FILENAME'] : __FILE__);
144  $this->errQueryString = (array_key_exists("QUERY_STRING", $_SERVER) ? $_SERVER['QUERY_STRING'] : '');
145 
146  if ($this->saveLog) {
147  $this->SaveLogMsg();
148  }
149  }

◆ SaveLogMsg()

CatchHandler::SaveLogMsg ( )
private

PRIVATE METHODSSave the log message for the error being raised

Definition at line 108 of file hcuLogError.i.

108  {
109 
110  $lLogMsg = $this->getErrMsg();
111  //** If this->errLogger is set then use this for logging the error,
112  // * If not, then save to the default error_log
113  if (!is_null($this->errLogger)) {
114  if ($this->noticeOnly) {
115  // * Default error log destination
116  $this->errLogger->notice($lLogMsg);
117  } else {
118  // * Default error log destination
119  $this->errLogger->error($lLogMsg);
120  }
121 
122  } else {
123  // ** logger not set, save with built in error_log function
124  error_log($lLogMsg);
125  }
126  }

◆ setErrorReporting()

CatchHandler::setErrorReporting (   $pNewReportLvl)

Set the level of php debugging

Parameters
intThe integer value representing the error reporting level
Returns
int the previous value of error reporting

Definition at line 201 of file hcuLogError.i.

201  {
202  $this->errReportLvl = $pNewReportLvl;
203  return error_reporting($pNewReportLvl);
204  }

◆ setLogger()

CatchHandler::setLogger (   $pLogger)

PUBLIC METHODSthis will set the logger object for the current error exception handler

Parameters
object$pLoggerThis is an instance of the ColorStandardLogger object

Definition at line 173 of file hcuLogError.i.

173  {
174 
175  if (is_a($pLogger, 'StandardLogger')) {
176  $this->errLogger = $pLogger;
177  }
178  }

Member Data Documentation

◆ $errLogger

CatchHandler::$errLogger = null
protected

PROPERTIESThe logger object used for writing to error log

Definition at line 29 of file hcuLogError.i.


The documentation for this class was generated from the following file: