Class Log_mail

Description

The Log_mail class is a concrete implementation of the Log:: abstract class which sends log messages to a mailbox.

The mail is actually sent when you close() the logger, or when the destructor is called (when the script is terminated).

PLEASE NOTE that you must create a Log_mail object using =&, like this : $logger =& Log::factory("mail", "recipient@example.com", ...)

This is a PEAR requirement for destructors to work properly. See http://pear.php.net/manual/en/class.pear.php

Located in /maintenance/libraries/pear/Log/mail.php (line 28)

Log
   |
   --Log_mail
Variable Summary
 string $_from
 string $_message
 string $_preamble
 string $_recipient
 string $_subject
Method Summary
 Log_mail Log_mail (string $name, [string $ident = ''], [array $conf = array()], [int $level = PEAR_LOG_DEBUG])
 void close ()
 void flush ()
 boolean log (mixed $message, [string $priority = null])
 void open ()
 void _Log_mail ()
Variables
string $_from = '' (line 42)

String holding the sender's email address.

  • access: private
string $_message = '' (line 63)

String holding the mail message body.

  • access: private
string $_preamble = '' (line 56)

String holding an optional preamble for the log messages.

  • access: private
string $_recipient = '' (line 35)

String holding the recipient's email address.

  • access: private
string $_subject = '[Log_mail] Log message' (line 49)

String holding the email's subject.

  • access: private

Inherited Variables

Inherited from Log

Log::$_id
Log::$_ident
Log::$_listeners
Log::$_mask
Log::$_opened
Log::$_priority
Methods
Constructor Log_mail (line 79)

Constructs a new Log_mail object.

Here is how you can customize the mail driver with the conf[] hash : $conf['from'] : the mail's "From" header line, $conf['subject'] : the mail's "Subject" line.

  • access: public
Log_mail Log_mail (string $name, [string $ident = ''], [array $conf = array()], [int $level = PEAR_LOG_DEBUG])
  • string $name: The filename of the logfile.
  • string $ident: The identity string.
  • array $conf: The configuration array.
  • int $level: Log messages up to and including this level.
close (line 139)

Closes the message, if it is open, and sends the mail.

This is implicitly called by the destructor, if necessary.

  • access: public
void close ()

Redefinition of:
Log::close()
Abstract implementation of the close() method.
flush (line 169)

Flushes the log output by forcing the email message to be sent now.

Events that are logged after flush() is called will be appended to a new email message.

  • since: Log 1.8.2
  • access: public
void flush ()

Redefinition of:
Log::flush()
Abstract implementation of the flush() method.
log (line 190)

Writes $message to the currently open mail message.

Calls open(), if necessary.

  • 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 121)

Starts a new mail message.

This is implicitly called by log(), if necessary.

  • access: public
void open ()

Redefinition of:
Log::open()
Abstract implementation of the open() method.
_Log_mail (line 110)

Destructor. Calls close().

  • access: private
void _Log_mail ()

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, 3 Dec 2004 12:26:57 +0000 by phpDocumentor 1.3.0RC3