spunQ_ConsoleLogTarget Class Reference

A LogTarget that prints messages to stdout. More...

Inheritance diagram for spunQ_ConsoleLogTarget:

spunQ_LogTarget spunQ_ILogTarget

List of all members.

Public Member Functions

 logMessage ($path, $priority, $message, $file, $line)
 This function will be called by the logging facility.

Static Public Member Functions

static getInstance ()
 The singleton getter.
static formatMessage ($message)
 Will make the message more readable.
static getLevelString ($priority)
 Will convert the numeric event priority to a string.
static convertObjectToString ($object, $indent=0, $visited=array(), $verbose=true)
 Converts an object to a string value.

Private Member Functions

 __construct ()
 Constructor.
 init ()
 Initializes cosole logger.
 adjustPath ($path)
 Will make the path a bit prettier by removing trailing paranthesis.

Private Attributes

 $initialized = false
 Stores whether init() was processed once.

Static Private Attributes

static $instance
 The singleton instance of this class.


Detailed Description

A LogTarget that prints messages to stdout.

Note that Stdout on a web server is the response to the browser. So this class is only useful if php is invoked from the command line. Other LogTargets could handle logging to the browser more efficiently.

Definition at line 9 of file ConsoleLogTarget.class.php.


Constructor & Destructor Documentation

spunQ_ConsoleLogTarget::__construct (  )  [private]

Constructor.

Defined to reduce visibility.

Definition at line 32 of file ConsoleLogTarget.class.php.


Member Function Documentation

spunQ_ConsoleLogTarget::adjustPath ( path  )  [private]

Will make the path a bit prettier by removing trailing paranthesis.

Parameters:
$path The path where the log event was triggered.
Returns:
string

Definition at line 85 of file ConsoleLogTarget.class.php.

static spunQ_LogTarget::convertObjectToString ( object,
indent = 0,
visited = array(),
verbose = true 
) [static, inherited]

Converts an object to a string value.

Parameters:
$object The object to convert.
$indent Indentation level of the hierarchy
$visited array of processed objects. Tracked to detect recursion.
Returns:
string

Definition at line 15 of file LogTarget.class.php.

static spunQ_ConsoleLogTarget::formatMessage ( message  )  [static]

Will make the message more readable.

Will convert objects using spunQ_LogTarget::convertObjectToString() and remove trailing newlines.

Parameters:
$message The message of the log event.
Returns:
$string

Definition at line 96 of file ConsoleLogTarget.class.php.

static spunQ_ConsoleLogTarget::getInstance (  )  [static]

The singleton getter.

Returns:
spunQ_ConsoleLogTarget

Definition at line 21 of file ConsoleLogTarget.class.php.

static spunQ_ConsoleLogTarget::getLevelString ( priority  )  [static]

Will convert the numeric event priority to a string.

Parameters:
$priority The numeric priority, could be either of the constants in spunQ_Logger.
Returns:
string

Definition at line 114 of file ConsoleLogTarget.class.php.

spunQ_ConsoleLogTarget::init (  )  [private]

Initializes cosole logger.

Prints css definitions if running in HTML mode.

Returns:
void
Todo:
Do not use the PHP_SAPI constant here, it's not very readable and complex enough to be isolated into a spunQ function (like spunQ::getSapi() & spunQ::SAPI_CONSOLE).

We should use a state parttern here, this is just awful.

Definition at line 51 of file ConsoleLogTarget.class.php.

spunQ_ConsoleLogTarget::logMessage ( path,
priority,
message,
file,
line 
)

This function will be called by the logging facility.

A logger rule matched a logging event that was triggered and this log target was provided to the rule.

See also:
spunQ_Logger
Parameters:
$path The source of the log event.
$priority The priority with which the Logger was invoked.
$message The message of the log event.
$file The path to the file where the event actually occured.
$line The line within the file where the log event was triggered
Returns:
spunQ_ILogTarget $this

Implements spunQ_ILogTarget.

Definition at line 66 of file ConsoleLogTarget.class.php.


Member Data Documentation

spunQ_ConsoleLogTarget::$initialized = false [private]

Stores whether init() was processed once.

Type:
boolean

Definition at line 40 of file ConsoleLogTarget.class.php.

spunQ_ConsoleLogTarget::$instance [static, private]

The singleton instance of this class.

Type:
spunQ_ConsoleLogTarget

Definition at line 15 of file ConsoleLogTarget.class.php.


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

Generated on Fri Jul 1 11:12:39 2011 for spunQ3 by  doxygen 1.5.9