Class: Log
Source Location: /pear/Log.php
The Log:: class implements both an abstraction for various logging mechanisms and the Subject end of a Subject-Observer pattern.
Author(s):
|
|
Class Details
Class Methods
method alert [line 271]
boolean alert(
mixed
$message)
|
|
A convenience function for logging an alert event. It will log a message at the PEAR_LOG_ALERT log level.
Tags:
Parameters:
method attach [line 735]
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.
Tags:
Parameters:
method close [line 219]
Abstract implementation of the close() method.
Tags:
Overridden in child classes as:
- Log_composite::close()
- Closes all of the child instances.
- Log_console::close()
- Closes the output stream.
- Log_daemon::close()
- Closes the connection to the system logger, if it is open.
- Log_display::close()
- Closes the display handler.
- Log_error_log::close()
- Closes the handler.
- Log_file::close()
- Closes the log file if it is open.
- Log_firebug::close()
- Closes the firebug handler.
- Log_mail::close()
- Closes the message, if it is open, and sends the mail.
- Log_mcal::close()
- Closes the calendar stream, if it is open.
- Log_mdb2::close()
- Closes the connection to the database if it is still open and we were the ones that opened it. It is the caller's responsible to close an existing connection that was passed to us via $conf['db'].
- Log_null::close()
- Closes the handler.
- Log_sql::close()
- Closes the connection to the database if it is still open and we were the ones that opened it. It is the caller's responsible to close an existing connection that was passed to us via $conf['db'].
- Log_sqlite::close()
- Closes the connection to the database if it is still open and we were the ones that opened it. It is the caller's responsible to close an existing connection that was passed to us via $conf['db'].
- Log_syslog::close()
- Closes the connection to the system logger, if it is open.
- Log_win::close()
- Closes the output stream if it is open. If there are still pending lines in the output buffer, the output window will be opened so that the buffer can be drained.
method crit [line 288]
boolean crit(
mixed
$message)
|
|
A convenience function for logging a critical event. It will log a message at the PEAR_LOG_CRIT log level.
Tags:
Parameters:
method debug [line 373]
boolean debug(
mixed
$message)
|
|
A convenience function for logging a debug event. It will log a message at the PEAR_LOG_DEBUG log level.
Tags:
Parameters:
method detach [line 757]
void detach(
object
$observer, boolean
1)
|
|
Removes a Log_observer instance from the list of observers.
Tags:
Parameters:
method emerg [line 254]
boolean emerg(
mixed
$message)
|
|
A convenience function for logging a emergency event. It will log a message at the PEAR_LOG_EMERG log level.
Tags:
Parameters:
method err [line 305]
boolean err(
mixed
$message)
|
|
A convenience function for logging a error event. It will log a message at the PEAR_LOG_ERR log level.
Tags:
Parameters:
method factory [line 129]
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.
Tags:
Parameters:
method flush [line 228]
Abstract implementation of the flush() method.
Tags:
Overridden in child classes as:
- Log_composite::flush()
- Flushes all child instances. It is assumed that all of the children have been successfully opened.
- Log_console::flush()
- Flushes all pending ("buffered") data to the output stream.
- Log_file::flush()
- Flushes all pending data to the file handle.
- Log_firebug::flush()
- Flushes all pending ("buffered") data.
- Log_mail::flush()
- Flushes the log output by forcing the email message to be sent now.
method getIdent [line 820]
Returns the current identification string.
Tags:
method getMask [line 676]
Returns the current level mask.
Tags:
method getPriority [line 705]
Returns the current default priority.
Tags:
method info [line 356]
boolean info(
mixed
$message)
|
|
A convenience function for logging a information event. It will log a message at the PEAR_LOG_INFO log level.
Tags:
Parameters:
method isComposite [line 794]
Indicates whether this is a composite class.
Tags:
Overridden in child classes as:
- Log_composite::isComposite()
- Returns true if this is a composite.
method log [line 237]
void log(
$message, [
$priority = null])
|
|
Abstract implementation of the log() method.
Tags:
Overridden in child classes as:
- Log_composite::log()
- Sends $message and $priority to each child of this composite. If the children aren't already open, they will be opened here.
- Log_console::log()
- Writes $message to the text console. Also, passes the message along to any Log_observer instances that are observing this Log.
- Log_daemon::log()
- Sends $message to the currently open syslog connection. Calls open() if necessary. Also passes the message along to any Log_observer instances that are observing this Log.
- Log_display::log()
- Writes $message to the text browser. Also, passes the message along to any Log_observer instances that are observing this Log.
- Log_error_log::log()
- Logs $message using PHP's error_log() function. The message is also passed along to any Log_observer instances that are observing this Log.
- 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.
- Log_firebug::log()
- Writes $message to Firebug console. Also, passes the message along to any Log_observer instances that are observing this Log.
- Log_mail::log()
- Writes $message to the currently open mail message.
- Log_mcal::log()
- Logs $message and associated information to the currently open calendar stream. Calls open() if necessary. Also passes the message along to any Log_observer instances that are observing this Log.
- Log_mdb2::log()
- Inserts $message to the currently open database. Calls open(), if necessary. Also passes the message along to any Log_observer instances that are observing this Log.
- Log_null::log()
- Simply consumes the log event. The message will still be passed along to any Log_observer instances that are observing this Log.
- Log_sql::log()
- Inserts $message to the currently open database. Calls open(), if necessary. Also passes the message along to any Log_observer instances that are observing this Log.
- Log_sqlite::log()
- Inserts $message to the currently open database. Calls open(), if necessary. Also passes the message along to any Log_observer instances that are observing this Log.
- Log_syslog::log()
- Sends $message to the currently open syslog connection. Calls open() if necessary. Also passes the message along to any Log_observer instances that are observing this Log.
- Log_win::log()
- Logs $message to the output window. The message is also passed along to any Log_observer instances that are observing this Log.
Parameters:
method MASK [line 589]
integer MASK(
integer
$priority)
|
|
Calculate the log mask for the given priority. This method may be called statically.
Tags:
Parameters:
method MAX [line 646]
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.
Tags:
Parameters:
method MIN [line 627]
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.
Tags:
Parameters:
method notice [line 339]
boolean notice(
mixed
$message)
|
|
A convenience function for logging a notice event. It will log a message at the PEAR_LOG_NOTICE log level.
Tags:
Parameters:
method open [line 210]
Abstract implementation of the open() method.
Tags:
Overridden in child classes as:
- Log_composite::open()
- Opens all of the child instances.
- Log_console::open()
- Open the output stream.
- Log_daemon::open()
- Opens a connection to the system logger, if it has not already been opened. This is implicitly called by log(), if necessary.
- Log_display::open()
- Opens the display handler.
- Log_error_log::open()
- Opens the handler.
- 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.
- Log_firebug::open()
- Opens the firebug handler.
- Log_mail::open()
- Starts a new mail message.
- Log_mcal::open()
- Opens a calendar stream, if it has not already been opened. This is implicitly called by log(), if necessary.
- Log_mdb2::open()
- Opens a connection to the database, if it has not already been opened. This is implicitly called by log(), if necessary.
- Log_null::open()
- Opens the handler.
- Log_sql::open()
- Opens a connection to the database, if it has not already been opened. This is implicitly called by log(), if necessary.
- Log_sqlite::open()
- Opens a connection to the database, if it has not already been opened. This is implicitly called by log(), if necessary.
- Log_syslog::open()
- Opens a connection to the system logger, if it has not already been opened. This is implicitly called by log(), if necessary.
- Log_win::open()
- The first time open() is called, it will open a new browser window and prepare it for output.
method priorityToString [line 533]
string priorityToString(
int
$priority)
|
|
Returns the string representation of a PEAR_LOG_* integer constant.
Tags:
Parameters:
method setIdent [line 807]
void setIdent(
string
$ident)
|
|
Sets this Log instance's identification string.
Tags:
Overridden in child classes as:
- Log_composite::setIdent()
- Sets this identification string for all of this composite's children.
- Log_mdb2::setIdent()
- Sets this Log instance's identification string. Note that this SQL-specific implementation will limit the length of the $ident string to sixteen (16) characters.
- Log_sql::setIdent()
- Sets this Log instance's identification string. Note that this SQL-specific implementation will limit the length of the $ident string to sixteen (16) characters.
Parameters:
method setMask [line 661]
integer setMask(
integer
$mask)
|
|
Set and return the level mask for the current Log instance.
Tags:
Parameters:
method setPriority [line 718]
void setPriority(
integer
$priority)
|
|
Sets the default priority to the specified value.
Tags:
Parameters:
method singleton [line 191]
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.
Tags:
Parameters:
method stringToPriority [line 561]
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.
Tags:
Parameters:
method UPTO [line 608]
integer UPTO(
integer
$priority)
|
|
Calculate the log mask for all priorities up to the given priority. This method may be called statically.
Tags:
Parameters:
method warning [line 322]
boolean warning(
mixed
$message)
|
|
A convenience function for logging a warning event. It will log a message at the PEAR_LOG_WARNING log level.
Tags:
Parameters:
|
|