|
| 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) |
| |
|
|
| $_opened = false |
| |
|
| $_id = 0 |
| |
|
| $_ident = '' |
| |
|
| $_priority = PEAR_LOG_INFO |
| |
|
| $_mask = PEAR_LOG_ALL |
| |
|
| $_listeners = array() |
| |
|
| $_backtrace_depth = 0 |
| |
| | $_formatMap |
| |
Informs each registered observer instance that a new message has been logged.
- Parameters
-
| array | $event | A 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 | $message | The 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 | $depth | The 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
Check if the given priority is included in the current level mask.
- Parameters
-
| integer | $priority | The priority to check. |
- Returns
- boolean True if the given priority is included in the current log mask.
protected
- Since
- Log 1.7.0
A convenience function for logging an alert event. It will log a message at the PEAR_LOG_ALERT log level.
- Parameters
-
| mixed | $message | String or object containing the message to log. |
- Returns
- boolean True if the message was successfully logged.
public
- Since
- Log 1.7.0
Adds a Log_observer instance to the list of observers that are listening for messages emitted by this Log instance.
- Parameters
-
| object | $observer | The Log_observer instance to attach as a listener. |
| boolean | True if the observer is successfully attached. |
public
- Since
- Log 1.0
Abstract implementation of the close() method.
- Since
- Log 1.0
A convenience function for logging a critical event. It will log a message at the PEAR_LOG_CRIT log level.
- Parameters
-
| mixed | $message | String or object containing the message to log. |
- Returns
- boolean True if the message was successfully logged.
public
- Since
- Log 1.7.0
A convenience function for logging a debug event. It will log a message at the PEAR_LOG_DEBUG log level.
- Parameters
-
| mixed | $message | String or object containing the message to log. |
- Returns
- boolean True if the message was successfully logged.
public
- Since
- Log 1.7.0
Removes a Log_observer instance from the list of observers.
- Parameters
-
| object | $observer | The Log_observer instance to detach from the list of listeners. |
| boolean | True if the observer is successfully detached. |
public
- Since
- Log 1.0
A convenience function for logging a emergency event. It will log a message at the PEAR_LOG_EMERG log level.
- Parameters
-
| mixed | $message | String or object containing the message to log. |
- Returns
- boolean True if the message was successfully logged.
public
- Since
- Log 1.7.0
A convenience function for logging a error event. It will log a message at the PEAR_LOG_ERR log level.
- Parameters
-
| mixed | $message | String 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 | $handler | The 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 | $name | The 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 | $ident | The identity reported to the log system. |
| array | $conf | A hash containing any additional configuration information that a subclass might need. |
| int | $level | Log 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
Abstract implementation of the flush() method.
- Since
- Log 1.8.2
Returns the current identification string.
- Returns
- string The current Log instance's identification string.
public
- Since
- Log 1.6.3
Returns the current level mask.
- Returns
- interger The current level mask.
public
- Since
- Log 1.7.0
Returns the current default priority.
- Returns
- integer The current default priority.
public
- Since
- Log 1.8.4
A convenience function for logging a information event. It will log a message at the PEAR_LOG_INFO log level.
- Parameters
-
| mixed | $message | String or object containing the message to log. |
- Returns
- boolean True if the message was successfully logged.
public
- Since
- Log 1.7.0
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
Calculate the log mask for the given priority.
This method may be called statically.
- Parameters
-
| integer | $priority | The priority whose mask will be calculated. |
- Returns
- integer The calculated log mask.
public
- Since
- Log 1.7.0
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 | $priority | The maximum priority covered by this mask. |
- Returns
- integer The resulting log mask.
public
- Since
- Log 1.9.4
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 | $priority | The minimum priority covered by this mask. |
- Returns
- integer The resulting log mask.
public
- Since
- Log 1.9.4
A convenience function for logging a notice event. It will log a message at the PEAR_LOG_NOTICE log level.
- Parameters
-
| mixed | $message | String or object containing the message to log. |
- Returns
- boolean True if the message was successfully logged.
public
- Since
- Log 1.7.0
Abstract implementation of the open() method.
- Since
- Log 1.0
| priorityToString |
( |
|
$priority | ) |
|
Returns the string representation of a PEAR_LOG_* integer constant.
- Parameters
-
| int | $priority | A 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 | $depth | The new backtrace depth. |
public
- Since
- Log 1.12.7
Sets this Log instance's identification string.
- Parameters
-
| string | $ident | The new identification string. |
public
- Since
- Log 1.6.3
Set and return the level mask for the current Log instance.
- Parameters
-
| integer | $mask | A bitwise mask of log levels. |
- Returns
- integer The current level mask.
public
- Since
- Log 1.7.0
Sets the default priority to the specified value.
- Parameters
-
| integer | $priority | The 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 | $handler | The 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 | $name | The 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 | $ident | The identity reported to the log system. |
| array | $conf | A hash containing any additional configuration information that a subclass might need. |
| int | $level | Log 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 | $name | String containing a priority name. |
- Returns
- string The PEAR_LOG_* integer contstant corresponding the the specified priority name.
public
- Since
- Log 1.9.0
Calculate the log mask for all priorities up to the given priority.
This method may be called statically.
- Parameters
-
| integer | $priority | The 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
A convenience function for logging a warning event. It will log a message at the PEAR_LOG_WARNING log level.
- Parameters
-
| mixed | $message | String or object containing the message to log. |
- Returns
- boolean True if the message was successfully logged.
public
- Since
- Log 1.7.0
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:
- /Users/alex/github/vcdeploy/lib/Log.php