vcdeploy  0.55
 All Data Structures Namespaces Files Functions Variables Pages
Public Member Functions | Static Public Member Functions | Data Fields
Log Class Reference
Inheritance diagram for Log:
Log_composite Log_console Log_daemon Log_display Log_error_log Log_file Log_firebug Log_mail Log_mcal Log_mdb2 Log_null Log_sql Log_sqlite Log_syslog Log_win

Public Member Functions

 open ()
 
 close ()
 
 flush ()
 
 log ($message, $priority=null)
 
 emerg ($message)
 
 alert ($message)
 
 crit ($message)
 
 err ($message)
 
 warning ($message)
 
 notice ($message)
 
 info ($message)
 
 debug ($message)
 
 _extractMessage ($message)
 
 _getBacktraceVars ($depth)
 
 setBacktraceDepth ($depth)
 
 _format ($format, $timestamp, $priority, $message)
 
 priorityToString ($priority)
 
 stringToPriority ($name)
 
 setMask ($mask)
 
 getMask ()
 
 _isMasked ($priority)
 
 getPriority ()
 
 setPriority ($priority)
 
 attach (&$observer)
 
 detach ($observer)
 
 _announce ($event)
 
 isComposite ()
 
 setIdent ($ident)
 
 getIdent ()
 

Static Public Member Functions

static factory ($handler, $name= '', $ident= '', $conf=array(), $level=PEAR_LOG_DEBUG)
 
static singleton ($handler, $name= '', $ident= '', $conf=array(), $level=PEAR_LOG_DEBUG)
 
static MASK ($priority)
 
static UPTO ($priority)
 
static MIN ($priority)
 
static MAX ($priority)
 

Data Fields

 $_opened = false
 
 $_id = 0
 
 $_ident = ''
 
 $_priority = PEAR_LOG_INFO
 
 $_mask = PEAR_LOG_ALL
 
 $_listeners = array()
 
 $_backtrace_depth = 0
 
 $_formatMap
 

Member Function Documentation

_announce (   $event)

Informs each registered observer instance that a new message has been logged.

Parameters
array$eventA hash describing the log event.

protected

_extractMessage (   $message)

Returns the string representation of the message data.

If $message is an object, _extractMessage() will attempt to extract the message text using a known method (such as a PEAR_Error object's getMessage() method). If a known method, cannot be found, the serialized representation of the object will be returned.

If the message data is already a string, it will be returned unchanged.

Parameters
mixed$messageThe original message data. This may be a string or any object.
Returns
string The string representation of the message.

protected

_format (   $format,
  $timestamp,
  $priority,
  $message 
)

Produces a formatted log line based on a format string and a set of variables representing the current log record and state.

Returns
string Formatted log string.

protected

Since
Log 1.9.4
_getBacktraceVars (   $depth)

Using debug_backtrace(), returns the file, line, and enclosing function name of the source code context from which log() was invoked.

Parameters
int$depthThe initial number of frames we should step back into the trace.
Returns
array Array containing four strings: the filename, the line, the function name, and the class name from which log() was called.

private

Since
Log 1.9.4
_isMasked (   $priority)

Check if the given priority is included in the current level mask.

Parameters
integer$priorityThe priority to check.
Returns
boolean True if the given priority is included in the current log mask.

protected

Since
Log 1.7.0
alert (   $message)

A convenience function for logging an alert event. It will log a message at the PEAR_LOG_ALERT log level.

Parameters
mixed$messageString or object containing the message to log.
Returns
boolean True if the message was successfully logged.

public

Since
Log 1.7.0
attach ( $observer)

Adds a Log_observer instance to the list of observers that are listening for messages emitted by this Log instance.

Parameters
object$observerThe Log_observer instance to attach as a listener.
booleanTrue if the observer is successfully attached.

public

Since
Log 1.0
close ( )

Abstract implementation of the close() method.

Since
Log 1.0
crit (   $message)

A convenience function for logging a critical event. It will log a message at the PEAR_LOG_CRIT log level.

Parameters
mixed$messageString or object containing the message to log.
Returns
boolean True if the message was successfully logged.

public

Since
Log 1.7.0
debug (   $message)

A convenience function for logging a debug event. It will log a message at the PEAR_LOG_DEBUG log level.

Parameters
mixed$messageString or object containing the message to log.
Returns
boolean True if the message was successfully logged.

public

Since
Log 1.7.0
detach (   $observer)

Removes a Log_observer instance from the list of observers.

Parameters
object$observerThe Log_observer instance to detach from the list of listeners.
booleanTrue if the observer is successfully detached.

public

Since
Log 1.0
emerg (   $message)

A convenience function for logging a emergency event. It will log a message at the PEAR_LOG_EMERG log level.

Parameters
mixed$messageString or object containing the message to log.
Returns
boolean True if the message was successfully logged.

public

Since
Log 1.7.0
err (   $message)

A convenience function for logging a error event. It will log a message at the PEAR_LOG_ERR log level.

Parameters
mixed$messageString or object containing the message to log.
Returns
boolean True if the message was successfully logged.

public

Since
Log 1.7.0
static factory (   $handler,
  $name = '',
  $ident = '',
  $conf = array(),
  $level = PEAR_LOG_DEBUG 
)
static

Attempts to return a concrete Log instance of type $handler.

Parameters
string$handlerThe type of concrete Log subclass to return. Attempt to dynamically include the code for this subclass. Currently, valid values are 'console', 'syslog', 'sql', 'file', and 'mcal'.
string$nameThe name of the actually log file, table, or other specific store to use. Defaults to an empty string, with which the subclass will attempt to do something intelligent.
string$identThe identity reported to the log system.
array$confA hash containing any additional configuration information that a subclass might need.
int$levelLog messages up to and including this level.
Returns
object Log The newly created concrete Log instance, or null on an error. public
Since
Log 1.0
flush ( )

Abstract implementation of the flush() method.

Since
Log 1.8.2
getIdent ( )

Returns the current identification string.

Returns
string The current Log instance's identification string.

public

Since
Log 1.6.3
getMask ( )

Returns the current level mask.

Returns
interger The current level mask.

public

Since
Log 1.7.0
getPriority ( )

Returns the current default priority.

Returns
integer The current default priority.

public

Since
Log 1.8.4
info (   $message)

A convenience function for logging a information event. It will log a message at the PEAR_LOG_INFO log level.

Parameters
mixed$messageString or object containing the message to log.
Returns
boolean True if the message was successfully logged.

public

Since
Log 1.7.0
isComposite ( )

Indicates whether this is a composite class.

Returns
boolean True if this is a composite class.

public

Since
Log 1.0
log (   $message,
  $priority = null 
)

Abstract implementation of the log() method.

Since
Log 1.0
static MASK (   $priority)
static

Calculate the log mask for the given priority.

This method may be called statically.

Parameters
integer$priorityThe priority whose mask will be calculated.
Returns
integer The calculated log mask.

public

Since
Log 1.7.0
static MAX (   $priority)
static

Calculate the log mask for all priorities less than or equal to the given priority. In other words, $priority will be the highests priority matched by the resulting mask.

This method may be called statically.

Parameters
integer$priorityThe maximum priority covered by this mask.
Returns
integer The resulting log mask.

public

Since
Log 1.9.4
static MIN (   $priority)
static

Calculate the log mask for all priorities greater than or equal to the given priority. In other words, $priority will be the lowest priority matched by the resulting mask.

This method may be called statically.

Parameters
integer$priorityThe minimum priority covered by this mask.
Returns
integer The resulting log mask.

public

Since
Log 1.9.4
notice (   $message)

A convenience function for logging a notice event. It will log a message at the PEAR_LOG_NOTICE log level.

Parameters
mixed$messageString or object containing the message to log.
Returns
boolean True if the message was successfully logged.

public

Since
Log 1.7.0
open ( )

Abstract implementation of the open() method.

Since
Log 1.0
priorityToString (   $priority)

Returns the string representation of a PEAR_LOG_* integer constant.

Parameters
int$priorityA PEAR_LOG_* integer constant.
Returns
string The string representation of $level.

public

Since
Log 1.0
setBacktraceDepth (   $depth)

Sets the starting depth to use when walking a backtrace in search of the function that invoked the log system. This is used on conjunction with the 'file', 'line', 'function', and 'class' formatters.

Parameters
int$depthThe new backtrace depth.

public

Since
Log 1.12.7
setIdent (   $ident)

Sets this Log instance's identification string.

Parameters
string$identThe new identification string.

public

Since
Log 1.6.3
setMask (   $mask)

Set and return the level mask for the current Log instance.

Parameters
integer$maskA bitwise mask of log levels.
Returns
integer The current level mask.

public

Since
Log 1.7.0
setPriority (   $priority)

Sets the default priority to the specified value.

Parameters
integer$priorityThe new default priority.

public

Since
Log 1.8.4
static singleton (   $handler,
  $name = '',
  $ident = '',
  $conf = array(),
  $level = PEAR_LOG_DEBUG 
)
static

Attempts to return a reference to a concrete Log instance of type $handler, only creating a new instance if no log instance with the same parameters currently exists.

You should use this if there are multiple places you might create a logger, you don't want to create multiple loggers, and you don't want to check for the existance of one each time. The singleton pattern does all the checking work for you.

You MUST call this method with the $var = &Log::singleton() syntax. Without the ampersand (&) in front of the method name, you will not get a reference, you will get a copy.

Parameters
string$handlerThe type of concrete Log subclass to return. Attempt to dynamically include the code for this subclass. Currently, valid values are 'console', 'syslog', 'sql', 'file', and 'mcal'.
string$nameThe name of the actually log file, table, or other specific store to use. Defaults to an empty string, with which the subclass will attempt to do something intelligent.
string$identThe identity reported to the log system.
array$confA hash containing any additional configuration information that a subclass might need.
int$levelLog messages up to and including this level.
Returns
object Log The newly created concrete Log instance, or null on an error. public
Since
Log 1.0
stringToPriority (   $name)

Returns the the PEAR_LOG_* integer constant for the given string representation of a priority name. This function performs a case-insensitive search.

Parameters
string$nameString containing a priority name.
Returns
string The PEAR_LOG_* integer contstant corresponding the the specified priority name.

public

Since
Log 1.9.0
static UPTO (   $priority)
static

Calculate the log mask for all priorities up to the given priority.

This method may be called statically.

Parameters
integer$priorityThe maximum priority covered by this mask.
Returns
integer The resulting log mask.

public

Since
Log 1.7.0
Deprecated:
deprecated since Log 1.9.4; use Log::MAX() instead
warning (   $message)

A convenience function for logging a warning event. It will log a message at the PEAR_LOG_WARNING log level.

Parameters
mixed$messageString or object containing the message to log.
Returns
boolean True if the message was successfully logged.

public

Since
Log 1.7.0

Field Documentation

$_formatMap
Initial value:
= array('%{timestamp}' => '%1$s',
'%{ident}' => '%2$s',
'%{priority}' => '%3$s',
'%{message}' => '%4$s',
'%{file}' => '%5$s',
'%{line}' => '%6$s',
'%{function}' => '%7$s',
'%{class}' => '%8$s',
'%\{' => '%%{')

The documentation for this class was generated from the following file:
Powered by AlphaNodes GmbH - Imprint