ZenMagick 0.9.6


org.zenmagick.service.ZMLogging

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

Field Summary
final mixed

ALL

final mixed

DEBUG

final mixed

ERROR

final mixed

INFO

final mixed

$NONE

final mixed

TRACE

final mixed

WARN

Fields inherited from org.zenmagick.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.ZMObject
attachMethod, get, getAttachedMethods, getPropertyNames, set, singleton

Field Detail

ALL

public final mixed ALL = 99999

DEBUG

public final mixed DEBUG = 4

ERROR

public final mixed ERROR = 1

INFO

public final mixed INFO = 3

NONE

public final mixed $NONE

TRACE

public final mixed TRACE = 5

WARN

public final mixed WARN = 2

Constructor Detail

ZMLogging

public ZMLogging()

Create new instance. /


Method Detail

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.

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.

exceptionHandler

public void exceptionHandler(Exception e)

PHP exception handler callback.

Parameters:
e - The exception.

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.

instance

public static void instance()

Get instance. /


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.

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.

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.6