Class Logger

Description

This Logger can be seen as Abstract implementation and holds all Common methods.

This impementation simply ECHOs the enabled Log Messages and is NOT made for productive use!

It takes a Log Level within the constructor. The LogLevel may also be changed during Script Runtime by calling:

  1.  $GLOBALS['LOGGER']->setLogLevel($logLevel);

If no Parameter is passed within the Constructor, the LogLevel will be fetched from the System Configuration:

  1.  $GLOBALS['_BIGACE']['log']['level']

The possible LogLevel are:

  • E_STRICT
  • E_ERROR
  • E_WARNING
  • E_PARSE
  • E_NOTICE
  • E_CORE_ERROR
  • E_CORE_WARNING
  • E_COMPILE_ERROR
  • E_COMPILE_WARNING
  • E_USER_ERROR
  • E_USER_WARNING
  • E_USER_NOTICE
  • E_DEBUG
  • E_SQL

  • version: $Id: Logger.php,v 1.9 2006/11/26 22:03:57 kpapst Exp $
  • copyright: Copyright (C) 2002-2006 Kevin Papst
  • author: Kevin Papst
  • license: GNU Public License


			
Direct descendents
Class Description
FileLogger This Logger saves Message to a file.
NullLogger This Logger does nothing. It behaves like /dev/null/ ;-)
RuntimeLogger This Logger saves all messages within an internal array. You may fetch these messages at the end of the call and use them for whatever you want (output in html, save to file...).
Variable Summary
mixed $logLevel
Method Summary
Logger Logger ([int $logLevel = null])
void finalize ()
String formatBacktrace ( $backtrace)
void getDescriptionForMode ( $mode)
boolean isDebugEnabled ()
boolean isModeEnabled (int $mode)
void log (int $mode, String $msg)
void logDebug (String $msg)
void logError (String $msg)
void logInfo (String $msg)
void logScriptError ( $errno,  $errmsg,  $filename,  $linenum,  $vars)
void logSQL (String $msg, [ $sql = ''])
void setLogLevel ( $level)
Variables
mixed $logLevel = E_ALL (line 71)
Methods
Constructor Logger (line 99)

Create a new Logger instance with the given Log Level.

Logger Logger ([int $logLevel = null])
  • int $logLevel: the LogLevel

Redefined in descendants as:
finalize (line 289)

Clean up all resources that might be used by this Logger!

void finalize ()

Redefined in descendants as:
formatBacktrace (line 250)

Formats one Entry of a Backtrace Entry.

This method will called in a forach loop, for all entry from debug_backtrace().

  • return: the formatted backtrace entry
String formatBacktrace ( $backtrace)
  • $backtrace
getDescriptionForMode (line 120)

Returns the Description for the given Mode.

  • access: protected
void getDescriptionForMode ( $mode)
  • $mode
isDebugEnabled (line 190)

Returns if Debugging is enabled.

Wrap Debug Calls within an if block for performance issues:

  1.  if ($LOGGER->isDebugEnabled())
  2.  {
  3.        $LOGGER->logDebug('foo');
  4.        $LOGGER->logDebug('bar');
  5.  }

  • return: true if Debug is enabled, otherwise false
boolean isDebugEnabled ()

Redefined in descendants as:
isModeEnabled (line 211)

Returns if the given Mode is enabled.

Wrap a list of Logger Calls for performance issues inside an if block, if you are sure that the given Level might be deactivated!

  1.  if ($LOGGER->isModeEnabled(E_SQL))
  2.  {
  3.        $LOGGER->log(E_SQL'SELECT * FROM foo');
  4.        $LOGGER->log(E_SQL'SELECT * FROM bar');
  5.  }

  • return: true if the Mode is enabled, otherwise false
boolean isModeEnabled (int $mode)
  • int $mode: the Mode to check

Redefined in descendants as:
log (line 170)

Log a message for a special mode, use this if you wanna use your own level/mode!

void log (int $mode, String $msg)
  • int $mode: the Log Level
  • String $msg: the Log Message

Redefined in descendants as:
logDebug (line 150)

Messages of this Type are most often used for development or error search!

void logDebug (String $msg)
  • String $msg: the Debug Message

Redefined in descendants as:
logError (line 132)

Messages of this Type will always be logged!

void logError (String $msg)
  • String $msg: the Error Message

Redefined in descendants as:
logInfo (line 141)

Messages of this Type are used for information messages.

void logInfo (String $msg)
  • String $msg: the Info Message

Redefined in descendants as:
logScriptError (line 219)

Callback function for the PHP logging mechanism.

void logScriptError ( $errno,  $errmsg,  $filename,  $linenum,  $vars)
  • $errno
  • $errmsg
  • $filename
  • $linenum
  • $vars

Redefined in descendants as:
logSQL (line 160)

Only SQL querys should be logged by this function, they have the lowest priority.

ONLY activate this level for Development or Error Search, NEVER on productive Systems!

void logSQL (String $msg, [ $sql = ''])
  • String $msg: the SQL Command
  • $sql

Redefined in descendants as:
setLogLevel (line 112)

Sets the Level, that defines which Messages will be dumped.

  • final:
  • see: config entry $GLOBALS['_BIGACE']['log']['level']
void setLogLevel ( $level)
  • $level

Documentation generated by phpDocumentor 1.3.1