Zend Framework  1.12
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
Zend_Log_Writer_Mail Class Reference

Public Member Functions

 __construct (Zend_Mail $mail, Zend_Layout $layout=null)
 Class constructor.
 
 setLayout ($layout)
 Set the layout.
 
 getLayoutFormatter ()
 Gets instance of Zend_Log_Formatter_Instance used for formatting a message using Zend_Layout, if applicable.
 
 setLayoutFormatter (Zend_Log_Formatter_Interface $formatter)
 Sets a specific formatter for use with Zend_Layout events.
 
 setSubjectPrependText ($subject)
 Allows caller to have the mail subject dynamically set to contain the entry counts per-priority level.
 
 shutdown ()
 Sends mail to recipient(s) if log entries are present.
 
- Public Member Functions inherited from Zend_Log_Writer_Abstract
 addFilter ($filter)
 Add a filter specific to this writer.
 
 write ($event)
 Log a message to this writer.
 
 setFormatter (Zend_Log_Formatter_Interface $formatter)
 Set a new formatter for this writer.
 
 shutdown ()
 Perform shutdown activites such as closing open resources.
 

Static Public Member Functions

static factory ($config)
 Create a new instance of Zend_Log_Writer_Mail.
 

Protected Member Functions

 _constructLayoutFromConfig (array $config)
 Construct a Zend_Layout instance based on a configuration array.
 
 _write ($event)
 Places event line into array of lines to be used as message body.
 
 _getFormattedNumEntriesPerPriority ()
 Gets a string of number of entries per-priority level that occurred, or an emptry string if none occurred.
 
- Protected Member Functions inherited from Zend_Log_Writer_Abstract
 _write ($event)
 Write a message to the log.
 

Static Protected Member Functions

static _constructMailFromConfig (array $config)
 Construct a Zend_Mail instance based on a configuration array.
 
- Static Protected Member Functions inherited from Zend_Log_Writer_Abstract
static _parseConfig ($config)
 Validate and optionally convert the config to array.
 

Protected Attributes

 $_eventsToMail = array()
 
 $_layoutEventsToMail = array()
 
 $_mail
 
 $_layout
 
 $_layoutFormatter
 
 $_numEntriesPerPriority = array()
 
 $_subjectPrependText
 
- Protected Attributes inherited from Zend_Log_Writer_Abstract
 $_filters = array()
 
 $_formatter
 

Static Protected Attributes

static $_methodMapHeaders
 

Constructor & Destructor Documentation

__construct ( Zend_Mail  $mail,
Zend_Layout  $layout = null 
)

Class constructor.

Constructs the mail writer; requires a Zend_Mail instance, and takes an optional Zend_Layout instance. If Zend_Layout is being used, $this->_layout->events will be set for use in the layout template.

Parameters
Zend_Mail$mailMail instance
Zend_Layout$layoutLayout instance; optional
Returns
void

Member Function Documentation

_constructLayoutFromConfig ( array  $config)
protected

Construct a Zend_Layout instance based on a configuration array.

Parameters
array$config
Returns
Zend_Layout
Exceptions
Zend_Log_Exception
static _constructMailFromConfig ( array  $config)
staticprotected

Construct a Zend_Mail instance based on a configuration array.

Parameters
array$config
Returns
Zend_Mail
Exceptions
Zend_Log_Exception
_getFormattedNumEntriesPerPriority ( )
protected

Gets a string of number of entries per-priority level that occurred, or an emptry string if none occurred.

Returns
string
_write (   $event)
protected

Places event line into array of lines to be used as message body.

Handles the formatting of both plaintext entries, as well as those rendered with Zend_Layout.

Parameters
array$eventEvent data
Returns
void
static factory (   $config)
static

Create a new instance of Zend_Log_Writer_Mail.

Parameters
array | Zend_Config$config
Returns
Zend_Log_Writer_Mail

Implements Zend_Log_FactoryInterface.

getLayoutFormatter ( )

Gets instance of Zend_Log_Formatter_Instance used for formatting a message using Zend_Layout, if applicable.

Returns
Zend_Log_Formatter_Interface|null The formatter, or null.
setLayout (   $layout)

Set the layout.

Parameters
Zend_Layout | array$layout
Returns
Zend_Log_Writer_Mail
Exceptions
Zend_Log_Exception
setLayoutFormatter ( Zend_Log_Formatter_Interface  $formatter)

Sets a specific formatter for use with Zend_Layout events.

Allows use of a second formatter on lines that will be rendered with Zend_Layout. In the event that Zend_Layout is not being used, this formatter cannot be set, so an exception will be thrown.

Parameters
Zend_Log_Formatter_Interface$formatter
Returns
Zend_Log_Writer_Mail
Exceptions
Zend_Log_Exception
setSubjectPrependText (   $subject)

Allows caller to have the mail subject dynamically set to contain the entry counts per-priority level.

Sets the text for use in the subject, with entry counts per-priority level appended to the end. Since a Zend_Mail subject can only be set once, this method cannot be used if the Zend_Mail object already has a subject set.

Parameters
string$subjectSubject prepend text.
Returns
Zend_Log_Writer_Mail
Exceptions
Zend_Log_Exception
shutdown ( )

Sends mail to recipient(s) if log entries are present.

Note that both plaintext and HTML portions of email are handled here.

Returns
void

Member Data Documentation

$_eventsToMail = array()
protected
$_layout
protected
$_layoutEventsToMail = array()
protected
$_layoutFormatter
protected
$_mail
protected
$_methodMapHeaders
staticprotected
Initial value:
= array(
'from' => 'setFrom',
'to' => 'addTo',
'cc' => 'addCc',
'bcc' => 'addBcc',
)
$_numEntriesPerPriority = array()
protected
$_subjectPrependText
protected