boolean alert(
mixed
$message
)
|
|
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. |
API Tags:
| Return: | True if the message was successfully logged. |
| Access: | public |
Information Tags:
void attach(
&$observer, object
$observer, boolean
1
)
|
|
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 |
1: |
True if the observer is successfully attached. |
|
|
&$observer: |
|
API Tags:
Information Tags:
Abstract implementation of the close() method.
Information Tags:
Redefined in descendants as:
boolean crit(
mixed
$message
)
|
|
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. |
API Tags:
| Return: | True if the message was successfully logged. |
| Access: | public |
Information Tags:
boolean debug(
mixed
$message
)
|
|
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. |
API Tags:
| Return: | True if the message was successfully logged. |
| Access: | public |
Information Tags:
void detach(
object
$observer, boolean
1
)
|
|
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 |
1: |
True if the observer is successfully detached. |
API Tags:
Information Tags:
boolean emerg(
mixed
$message
)
|
|
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. |
API Tags:
| Return: | True if the message was successfully logged. |
| Access: | public |
Information Tags:
boolean err(
mixed
$message
)
|
|
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. |
API Tags:
| Return: | True if the message was successfully logged. |
| Access: | public |
Information Tags:
object Log &factory(
string
$handler, [string
$name = ''], [string
$ident = ''], [array
$conf = array()], [int
$level = PEAR_LOG_DEBUG]
)
|
|
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. |
API Tags:
| Return: | The newly created concrete Log instance, or null on an error. |
| Access: | public |
Information Tags:
Abstract implementation of the flush() method.
Information Tags:
Redefined in descendants as:
Returns the current identification string.
API Tags:
| Return: | The current Log instance's identification string. |
| Access: | public |
Information Tags:
Returns the current level mask.
API Tags:
| Return: | The current level mask. |
| Access: | public |
Information Tags:
Returns the current default priority.
API Tags:
| Return: | The current default priority. |
| Access: | public |
Information Tags:
boolean info(
mixed
$message
)
|
|
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. |
API Tags:
| Return: | True if the message was successfully logged. |
| Access: | public |
Information Tags:
Indicates whether this is a composite class.
API Tags:
| Return: | True if this is a composite class. |
| Access: | public |
Information Tags:
void log(
$message, [
$priority = null]
)
|
|
Abstract implementation of the log() method.
Parameters:
Information Tags:
Redefined in descendants as:
-
Log_file::log()
: Logs $message to the output window. The message is also passed along to any Log_observer instances that are observing this Log.
integer MASK(
integer
$priority
)
|
|
Calculate the log mask for the given priority.
This method may be called statically.
Parameters:
|
integer |
$priority: |
The priority whose mask will be calculated. |
API Tags:
| Return: | The calculated log mask. |
| Access: | public |
Information Tags:
integer MAX(
integer
$priority
)
|
|
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. |
API Tags:
| Return: | The resulting log mask. |
| Access: | public |
Information Tags:
integer MIN(
integer
$priority
)
|
|
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. |
API Tags:
| Return: | The resulting log mask. |
| Access: | public |
Information Tags:
boolean notice(
mixed
$message
)
|
|
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. |
API Tags:
| Return: | True if the message was successfully logged. |
| Access: | public |
Information Tags:
Abstract implementation of the open() method.
Information Tags:
Redefined in descendants as:
-
Log_file::open()
: Opens the log file for output. If the specified log file does not already exist, it will be created. By default, new log entries are appended to the end of the log file.
string priorityToString(
int
$priority
)
|
|
Returns the string representation of a PEAR_LOG_* integer constant.
Parameters:
|
int |
$priority: |
A PEAR_LOG_* integer constant. |
API Tags:
| Return: | The string representation of $level. |
Information Tags:
void setIdent(
string
$ident
)
|
|
Sets this Log instance's identification string.
Parameters:
|
string |
$ident: |
The new identification string. |
API Tags:
Information Tags:
integer setMask(
integer
$mask
)
|
|
Set and return the level mask for the current Log instance.
Parameters:
|
integer |
$mask: |
A bitwise mask of log levels. |
API Tags:
| Return: | The current level mask. |
| Access: | public |
Information Tags:
void setPriority(
integer
$priority
)
|
|
Sets the default priority to the specified value.
Parameters:
|
integer |
$priority: |
The new default priority. |
API Tags:
Information Tags:
object Log &singleton(
string
$handler, [string
$name = ''], [string
$ident = ''], [array
$conf = array()], [int
$level = PEAR_LOG_DEBUG]
)
|
|
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. |
API Tags:
| Return: | The newly created concrete Log instance, or null on an error. |
| Access: | public |
Information Tags:
string stringToPriority(
string
$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. |
API Tags:
| Return: | The PEAR_LOG_* integer contstant corresponding the the specified priority name. |
Information Tags:
integer UPTO(
integer
$priority
)
|
|
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. |
API Tags:
| Return: | The resulting log mask. |
| Deprecated: | deprecated since Log 1.9.4; use Log::MAX() instead |
| Access: | public |
Information Tags:
boolean warning(
mixed
$message
)
|
|
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. |
API Tags:
| Return: | True if the message was successfully logged. |
| Access: | public |
Information Tags:
void _announce(
array
$event
)
|
|
Informs each registered observer instance that a new message has been logged.
Parameters:
|
array |
$event: |
A hash describing the log event. |
API Tags:
string _extractMessage(
mixed
$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. |
API Tags:
| Return: | The string representation of the message. |
| Access: | private |
string _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.
Parameters:
|
|
$format: |
|
|
|
$timestamp: |
|
|
|
$priority: |
|
|
|
$message: |
|
API Tags:
| Return: | Formatted log string. |
| Access: | private |
Information Tags:
array _getBacktraceVars(
int
$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. |
API Tags:
| Return: | Array containing three strings: the filename, the line, and the function name from which log() was called. |
| Access: | private |
Information Tags:
boolean _isMasked(
integer
$priority
)
|
|
Check if the given priority is included in the current level mask.
Parameters:
|
integer |
$priority: |
The priority to check. |
API Tags:
| Return: | True if the given priority is included in the current log mask. |
| Access: | private |
Information Tags: