Log
[ class tree: Log ] [ index: Log ] [ all elements ]

Class: Log_mdb2

Source Location: /Log-1.12.7/Log/mdb2.php

Class Overview

Log
   |
   --Log_mdb2

The Log_mdb2 class is a concrete implementation of the Log:: abstract class which sends messages to an SQL server. Each entry occupies a separate row in the database.


Author(s):

Methods


Inherited Variables

Inherited Methods

Class: Log

Log::alert()
A convenience function for logging an alert event. It will log a message at the PEAR_LOG_ALERT log level.
Log::attach()
Adds a Log_observer instance to the list of observers that are listening for messages emitted by this Log instance.
Log::close()
Abstract implementation of the close() method.
Log::crit()
A convenience function for logging a critical event. It will log a message at the PEAR_LOG_CRIT log level.
Log::debug()
A convenience function for logging a debug event. It will log a message at the PEAR_LOG_DEBUG log level.
Log::detach()
Removes a Log_observer instance from the list of observers.
Log::emerg()
A convenience function for logging a emergency event. It will log a message at the PEAR_LOG_EMERG log level.
Log::err()
A convenience function for logging a error event. It will log a message at the PEAR_LOG_ERR log level.
Log::factory()
Attempts to return a concrete Log instance of type $handler.
Log::flush()
Abstract implementation of the flush() method.
Log::getIdent()
Returns the current identification string.
Log::getMask()
Returns the current level mask.
Log::getPriority()
Returns the current default priority.
Log::info()
A convenience function for logging a information event. It will log a message at the PEAR_LOG_INFO log level.
Log::isComposite()
Indicates whether this is a composite class.
Log::log()
Abstract implementation of the log() method.
Log::MASK()
Calculate the log mask for the given priority.
Log::MAX()
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.
Log::MIN()
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.
Log::notice()
A convenience function for logging a notice event. It will log a message at the PEAR_LOG_NOTICE log level.
Log::open()
Abstract implementation of the open() method.
Log::priorityToString()
Returns the string representation of a PEAR_LOG_* integer constant.
Log::setBacktraceDepth()
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.
Log::setIdent()
Sets this Log instance's identification string.
Log::setMask()
Set and return the level mask for the current Log instance.
Log::setPriority()
Sets the default priority to the specified value.
Log::singleton()
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.
Log::stringToPriority()
Returns the the PEAR_LOG_* integer constant for the given string representation of a priority name. This function performs a case-insensitive search.
Log::UPTO()
Calculate the log mask for all priorities up to the given priority.
Log::warning()
A convenience function for logging a warning event. It will log a message at the PEAR_LOG_WARNING log level.
Log::_announce()
Informs each registered observer instance that a new message has been logged.
Log::_extractMessage()
Returns the string representation of the message data.
Log::_format()
Produces a formatted log line based on a format string and a set of variables representing the current log record and state.
Log::_isMasked()
Check if the given priority is included in the current level mask.

Class Details

[line 34]
The Log_mdb2 class is a concrete implementation of the Log:: abstract class which sends messages to an SQL server. Each entry occupies a separate row in the database.

This implementation uses PEAR's MDB2 database abstraction layer.

CREATE TABLE log_table ( id INT NOT NULL, logtime TIMESTAMP NOT NULL, ident CHAR(16) NOT NULL, priority INT NOT NULL, message VARCHAR(200), PRIMARY KEY (id) );



[ Top ]


Method Detail

Log_mdb2 (Constructor)   [line 115]

Log_mdb2 Log_mdb2( string $name, [string $ident = ''], [array $conf = array()], [int $level = PEAR_LOG_DEBUG])

Constructs a new sql logging object.
  • Access: public

Parameters:

string   $name     The target SQL table.
string   $ident     The identification field.
array   $conf     The connection configuration array.
int   $level     Log messages up to and including this level.

[ Top ]

close   [line 190]

boolean 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'].
  • Return: True on success, false on failure.
  • Access: public

Overrides Log::close() (Abstract implementation of the close() method.)
[ Top ]

log   [line 235]

boolean log( mixed $message, [string $priority = null])

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.
  • Return: True on success or false on failure.
  • Access: public

Overrides Log::log() (Abstract implementation of the log() method.)

Parameters:

mixed   $message     String or object containing the message to log.
string   $priority     The priority of the message. Valid values are: PEAR_LOG_EMERG, PEAR_LOG_ALERT, PEAR_LOG_CRIT, PEAR_LOG_ERR, PEAR_LOG_WARNING, PEAR_LOG_NOTICE, PEAR_LOG_INFO, and PEAR_LOG_DEBUG.

[ Top ]

open   [line 161]

boolean open( )

Opens a connection to the database, if it has not already been opened. This is implicitly called by log(), if necessary.
  • Return: True on success, false on failure.
  • Access: public

Overrides Log::open() (Abstract implementation of the open() method.)
[ Top ]

setIdent   [line 217]

void setIdent( string $ident)

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.
  • Since: Log 1.8.5
  • Access: public

Overrides Log::setIdent() (Sets this Log instance's identification string.)

Parameters:

string   $ident     The new identification string.

[ Top ]


Documentation generated on Mon, 19 Sep 2011 02:00:07 +0000 by phpDocumentor 1.4.3. PEAR Logo Copyright © PHP Group 2004.