Class Log_sqlite

Description

The Log_sqlite class is a concrete implementation of the Log:: abstract class which sends messages to an Sqlite database.

Each entry occupies a separate row in the database.

This implementation uses PHP native Sqlite functions.

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

Located in /maintenance/libraries/pear/Log/sqlite.php (line 43)

Log
   |
   --Log_sqlite
Variable Summary
 object $_db
 array $_options
 string $_table
Method Summary
 Log_sqlite Log_sqlite (string $name, [string $ident = ''], mixed &$conf, [int $level = PEAR_LOG_DEBUG])
 boolean close ()
 boolean log (mixed $message, [string $priority = null])
 boolean open ()
 boolean _createTable ()
Variables
object $_db = null (line 58)

Object holding the database handle.

  • access: private
boolean $_existingConnection = false (line 65)

Flag indicating that we're using an existing database connection.

  • access: private
array $_options = array('mode' => 0666,
'persistent' => false)
(line 50)

Array containing the connection defaults

  • access: private
string $_table = 'log_table' (line 72)

String holding the database table to use.

  • access: private

Inherited Variables

Inherited from Log

Log::$_id
Log::$_ident
Log::$_listeners
Log::$_mask
Log::$_opened
Log::$_priority
Methods
Constructor Log_sqlite (line 86)

Constructs a new sql logging object.

  • access: public
Log_sqlite Log_sqlite (string $name, [string $ident = ''], mixed &$conf, [int $level = PEAR_LOG_DEBUG])
  • string $name: The target SQL table.
  • string $ident: The identification field.
  • mixed $conf: Can be an array of configuration options used to open a new database connection or an already opened sqlite connection.
  • int $level: Log messages up to and including this level.
close (line 144)

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
boolean close ()

Redefinition of:
Log::close()
Abstract implementation of the close() method.
log (line 172)

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
boolean log (mixed $message, [string $priority = null])
  • 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.

Redefinition of:
Log::log()
Abstract implementation of the log() method.
open (line 111)

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
boolean open ()

Redefinition of:
Log::open()
Abstract implementation of the open() method.
_createTable (line 214)

Checks whether the log table exists and creates it if necessary.

  • return: True on success or false on failure.
  • access: private
boolean _createTable ()

Inherited Methods

Inherited From Log

 Log::alert()
 Log::attach()
 Log::close()
 Log::crit()
 Log::debug()
 Log::detach()
 Log::emerg()
 Log::err()
 Log::factory()
 Log::flush()
 Log::getIdent()
 Log::getMask()
 Log::getPriority()
 Log::info()
 Log::isComposite()
 Log::log()
 Log::MASK()
 Log::notice()
 Log::open()
 Log::priorityToString()
 Log::setIdent()
 Log::setMask()
 Log::setPriority()
 Log::singleton()
 Log::UPTO()
 Log::warning()
 Log::_announce()
 Log::_extractMessage()
 Log::_isMasked()

Documentation generated on Fri, 24 Dec 2004 13:03:27 +0000 by phpDocumentor 1.3.0RC3