ZenMagick 0.9.8


org.zenmagick.core.services.misc.ZMLogging
\core\services\misc\ZMLogging.php at line 36

Class ZMLogging

ZMObject
└─ZMLogging

public class ZMLogging
extends ZMObject

ZenMagick logging service.

The dump and trace methods are browser oriented and will generate HTML in the response page.

Browser output depends on the PHP ini setting display_errors.

Author:
DerManoMann
Version:
$Id: ZMLogging.php 2619 2009-11-23 01:20:47Z dermanomann $

Field Summary
final int

ALL

Log level: ALL.

final int

DEBUG

Log level: Debug.

final int

ERROR

Log level: Error.

final int

INFO

Log level: Info.

final int

$NONE

Log level: Disabled.

final int

TRACE

Log level: Trace.

final int

WARN

Log level: Warning.

Fields inherited from org.zenmagick.core.ZMObject
properties_
Constructor Summary

ZMLogging()

Create new instance.

Method Summary
void

dump(mixed obj, string msg, int level)

Simple dump function.

void

errorHandler(int errno, string errstr, string errfile, int errline, array errcontext)

PHP error handler callback.

void

exceptionHandler(Exception e)

PHP exception handler callback.

protected string

formatLog(int errno, string errstr, string errfile, int errline, array errcontext)

Format error handler log line.

static void

instance()

Get instance.

void

log(string msg, int level)

Simple logging function.

void

logError(string line, array info)

A callback function that can be overriden to implement custom logging.

void

trace(mixed msg, int level)

Create a simple stack trace.

Methods inherited from org.zenmagick.core.ZMObject
attachMethod, get, getAttachedMethods, getPropertyNames, set, singleton

Field Detail

\core\services\misc\ZMLogging.php at line 51

ALL

public final int ALL = 99999

Log level: ALL.


\core\services\misc\ZMLogging.php at line 47

DEBUG

public final int DEBUG = 4

Log level: Debug.


\core\services\misc\ZMLogging.php at line 41

ERROR

public final int ERROR = 1

Log level: Error.


\core\services\misc\ZMLogging.php at line 45

INFO

public final int INFO = 3

Log level: Info.


\core\services\misc\ZMLogging.php at line 39

NONE

public final int $NONE

Log level: Disabled.


\core\services\misc\ZMLogging.php at line 49

TRACE

public final int TRACE = 5

Log level: Trace.


\core\services\misc\ZMLogging.php at line 43

WARN

public final int WARN = 2

Log level: Warning.


Constructor Detail

\core\services\misc\ZMLogging.php at line 57

ZMLogging

public ZMLogging()

Create new instance.


Method Detail

\core\services\misc\ZMLogging.php at line 105

dump

public void dump(mixed obj, string msg, int level)

Simple dump function.

Parameters:
obj - The object to dump.
msg - An optional message.
level - Optional level; default: ZMLogging::DEBUG.

\core\services\misc\ZMLogging.php at line 231

errorHandler

public void errorHandler(int errno, string errstr, string errfile, int errline, array errcontext)

PHP error handler callback.

if configured, this method will append all messages to the file configured with zmLogFilename.

If no file is configured, the regular webserver error file will be used.

Parameters:
errno - The error level.
errstr - The error message.
errfile - The source filename.
errline - The line number.
errcontext - All variables of scope when error triggered.

\core\services\misc\ZMLogging.php at line 244

exceptionHandler

public void exceptionHandler(Exception e)

PHP exception handler callback.

Parameters:
e - The exception.

\core\services\misc\ZMLogging.php at line 170

formatLog

protected string formatLog(int errno, string errstr, string errfile, int errline, array errcontext)

Format error handler log line.

Parameters:
errno - The error level.
errstr - The error message.
errfile - The source filename.
errline - The line number.
errcontext - All variables of scope when error triggered.
Returns:
A formatted log line.

\core\services\misc\ZMLogging.php at line 71

instance

public static void instance()

Get instance.


\core\services\misc\ZMLogging.php at line 85

log

public void log(string msg, int level)

Simple logging function.

Messages will either be appended to the webserver's error log or, if a custom error handler is installed, trigger a E_USER_NOTICE error.

Parameters:
msg - The message to log.
level - Optional level; default: ZMLogging::INFO.

\core\services\misc\ZMLogging.php at line 206

logError

public void logError(string line, array info)

A callback function that can be overriden to implement custom logging.

Parameters:
line - The pre-fromatted log line.
info - All available log information.

\core\services\misc\ZMLogging.php at line 126

trace

public void trace(mixed msg, int level)

Create a simple stack trace.

Parameters:
msg - An optional string or array.
level - Optional level; default: ZMLogging::DEBUG.

ZenMagick 0.9.8