Agile Toolkit  4.2
Agile Toolkit is a powerful web development framework. Inspired by GUI Applications development
Logger Class Reference
Inheritance diagram for Logger:
AbstractController AbstractObject

Public Member Functions

 init ()
 showDebugInfo ()
 gatherDetails ()
 findFrame ($function_name, $shift=0)
 showRenderTree ($e, $obj)
 logCaughtException ($e)
 caughtException ($caller, $e)
 outputWarning ($caller, $msg, $shift=0)
 outputDebug ($caller, $msg, $shift=0)
 outputInfo ($caller, $msg, $shift=0, $nohtml=false)
 outputFatal ($caller, $msg, $shift=0)
 htmlLine ($msg, $frame=array(), $prefix=null)
 txtLine ($msg, $frame=array(), $prefix=null)
 logLine ($msg, $shiftfunc=null, $severity='info', $trace=null)
 logVar ($var, $msg="", $shiftfunc=null, $severity='debug')
 logException ($e)
 openLogFile ($severity='error')
 writeLogMessage ()
 backtrace ($sh=null, $backtrace=null)
 cleanupLogDirectory ()
 txtBacktrace ($sh=null, $backtrace=null)
 Debug ($filename)
 _sec2time ($sec)
 _microtime_float ()
 p ($message, $file=null, $line=null)

Data Fields

 $web_output = 'full'
 $log_output = null
 $public_error_message = null
 $details = array()
 $recskip = array()

Protected Attributes


Member Function Documentation

_sec2time ( sec)
backtrace ( sh = null,
backtrace = null 
caughtException ( caller,
Debug ( filename)
findFrame ( function_name,
shift = 0 
htmlLine ( msg,
frame = array(),
prefix = null 
init ( )

Initialize object. Always call parent

This method is called for initialization

Reimplemented from AbstractObject.

logException ( e)
logLine ( msg,
shiftfunc = null,
severity = 'info',
trace = null 
logVar ( var,
msg = "",
shiftfunc = null,
severity = 'debug' 
openLogFile ( severity = 'error')
outputDebug ( caller,
shift = 0 
outputFatal ( caller,
shift = 0 
outputInfo ( caller,
shift = 0,
nohtml = false 
outputWarning ( caller,
shift = 0 
p ( message,
file = null,
line = null 
showRenderTree ( e,
txtBacktrace ( sh = null,
backtrace = null 
txtLine ( msg,
frame = array(),
prefix = null 

Field Documentation


Always points to current API

Reimplemented from AbstractObject.

$details = array()
$log_debug_file [protected]
$log_error_file [protected]
$log_info_file [protected]
$log_output = null

Logger class is implemented a more sophisticated and usable error handling.

Normally all error messages are sent through the API class by using one of two ways:

1. throwing exception, which is caught by Api class (unless you catch it yourself) 2. calling $this->fatal() which would throw exception for you (useful when calling from PHP4 compatible components)

additionally there are way to pass info and warnings by calling:

$this->warning(); $this->info(); $this->debug();

Debug information will reach logs only if debug mode is set.

==[ Controling debug info ]===================================================

AModules3 support two ways to set debug mode. Global and Local.

Global mode is set by setting $api->debug to true. Local mode is set by setting particular object's $this->debug to true.

In local mode only debug info generated by particular object will be sent through

This class does not manage debug modes, which is a task for Api and all other objects.

$config['debug']=true; // turns on global debug mode.

==[ Severity ]================================================================

AModules3 have 4 severity types: debug, info, warning and fatal.

Expected exceptions might be reported as warnings and uncaught exceptions are fatal. Forms have their own validation and errors on the form is completely separate system.

Sample fatal errors:

  • unable to execute query
  • method not found
  • mandatory data is not specified fatal errors will automatically terminate application execution.

Warnings messages:

  • duplicate child added to the object with same name
  • method is called without specifying important argument

Sample info messages:

  • user tried to access restricted page
  • monthly log rotation routine finished successfuly
  • user information is automatically converted (from format used in previous version) Info messages are passed as strings without extended information.

Debug messages

  • called some function which might contain errors or being debuged
  • user logged in or logged out
  • when debuging, even more messages might be sent as debug() WARNING: please keep debug information to the minimum. Debug information is accompanied with extended information. Debug information is always saved into logs or is available on the screen.

AModules3 core tries not to produce any debug or info messages to keep files clean. Even if it does, those calls might eventually be cleaned out.

==[ Configuring logger ]====================================================== Logger uses 2 output destinations, and 3 ways to restrict output information.

Output destination: stdout (webpage), logs Restrict options: 'full', 'light', null

stdout is different for ApiCLI and ApiWeb classes. Web output might contact tags or even some AJAX elements. Logs and ApiCLI uses the same output format.

Web output for info, warning and debug messages relies on templates but fatal messages are template independent.

==[ Output restriction ]====================================================== null: this option will surpress all output. When used with logs, you won't even need an empty directory. Web output will be clean of any messages.

If fatal error occurs, if 'null' is used with web output, you will see message (public_error_message), instead of the actual error.

light: only message is outputed. Even if debug mode is on, backtraces and additional information is stripped off. This method is best if you are using application for intranet and know uses or if you are doing beta testing. This output won't contain any sensitive information such as table names, field names, actual data)

when used with logs, each message takes one line.

full: this will output all the information available including: error message line/file/function where error message occured (guessed) additional information (such as last_query and error_message from DBlite) complete backtrace.

when used with logs, each message takes several lines.

==[ Activation ]================================================================== To start using this class in your applicaion you should:


If you do not activate Logger, output will be similar to: web_output='full'; log_output=null;

==[ Extending ]====================================================================

You can extend this class to add additional features. Please notify me if you think something essential is missing out

Debug functions were contributed my

Reimplemented from AbstractObject.

$public_error_message = null
$recskip = array()
$web_output = 'full'

The documentation for this class was generated from the following file:
 All Data Structures Files Functions Variables Enumerations