Log/Writer/Mail.php

Show: PublicProtectedPrivateinherited
Table of Contents
Zend Framework
LICENSE This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to [email protected] so we can send you a copy immediately.
Category
Zend  
Copyright
Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Log  
Subpackage
Writer  
Version
$Id$  

\Zend_Log_Writer_Mail

Package: Zend_Log\Writer
Class used for writing log messages to email via Zend_Mail.
Allows for emailing log messages at and above a certain level via a Zend_Mail object. Note that this class only sends the email upon completion, so any log entries accumulated are sent in a single email.
Parent(s)
\Zend_Log_Writer_Abstract
Category
Zend  
Copyright
Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Version
$Id$  

Properties

>VPropertyprotectedarray $_eventsToMail = array()
Array of formatted events to include in message body.
Default valuearray()Details
Type
array
>VPropertyprotected\Zend_Layout $_layout
Zend_Layout instance to use; optional.
Details
Type
\Zend_Layout
>VPropertyprotectedarray $_layoutEventsToMail = array()
Array of formatted lines for use in an HTML email body; these events are formatted with an optional formatter if the caller is using Zend_Layout.
Default valuearray()Details
Type
array
>VPropertyprotected\Zend_Log_Formatter_Interface $_layoutFormatter
Optional formatter for use when rendering with Zend_Layout.
>VPropertyprotected\Zend_Mail $_mail
Zend_Mail instance to use
Details
Type
\Zend_Mail
>VPropertyprotectedarray $_methodMapHeaders = array('from' => 'setFrom', 'to' => 'addTo', 'cc' => 'addCc', 'bcc' => 'addBcc')
static
MethodMap for Zend_Mail's headers
Default valuearray('from' => 'setFrom', 'to' => 'addTo', 'cc' => 'addCc', 'bcc' => 'addBcc')Details
Type
array
>VPropertyprotectedarray $_numEntriesPerPriority = array()
Array keeping track of the number of entries per priority level.
Default valuearray()Details
Type
array
>VPropertyprotectedstring|null $_subjectPrependText
Subject prepend text.
Can only be used of the Zend_Mail object has not already had its subject line set. Using this will cause the subject to have the entry counts per-priority level appended to it.
Details
Type
string | null

Methods

methodpublic__construct(\Zend_Mail $mail, \Zend_Layout $layout = null) : void

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
NameTypeDescription
$mail\Zend_Mail

Mail instance

$layout\Zend_Layout

Layout instance; optional

methodprotected_constructLayoutFromConfig(array $config) : \Zend_Layout

Construct a Zend_Layout instance based on a configuration array

Parameters
NameTypeDescription
$configarray
Returns
TypeDescription
\Zend_Layout
Throws
ExceptionDescription
\Zend_Log_Exception
methodprotected_constructMailFromConfig(array $config) : \Zend_Mail
static

Construct a Zend_Mail instance based on a configuration array

Parameters
NameTypeDescription
$configarray
Returns
TypeDescription
\Zend_Mail
Throws
ExceptionDescription
\Zend_Log_Exception
methodprotected_getFormattedNumEntriesPerPriority() : string

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

Returns
TypeDescription
string
methodprotected_write(array $event) : void

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
NameTypeDescription
$eventarray

Event data

methodpublicfactory(array | \Zend_Config $config) : \Zend_Log_Writer_Mail
static

Create a new instance of Zend_Log_Writer_Mail

Parameters
NameTypeDescription
$configarray | \Zend_Config
Returns
TypeDescription
\Zend_Log_Writer_Mail
methodpublicgetLayoutFormatter() : \Zend_Log_Formatter_Interface | null

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

Returns
TypeDescription
\Zend_Log_Formatter_Interface | nullThe formatter, or null.
methodpublicsetLayout(\Zend_Layout | array $layout) : \Zend_Log_Writer_Mail

Set the layout

Parameters
NameTypeDescription
$layout\Zend_Layout | array
Returns
TypeDescription
\Zend_Log_Writer_Mail
Throws
ExceptionDescription
\Zend_Log_Exception
methodpublicsetLayoutFormatter(\Zend_Log_Formatter_Interface $formatter) : \Zend_Log_Writer_Mail

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
NameTypeDescription
$formatter\Zend_Log_Formatter_Interface
Returns
TypeDescription
\Zend_Log_Writer_Mail
Throws
ExceptionDescription
\Zend_Log_Exception
methodpublicsetSubjectPrependText(string $subject) : \Zend_Log_Writer_Mail

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
NameTypeDescription
$subjectstring

Subject prepend text.

Returns
TypeDescription
\Zend_Log_Writer_Mail
Throws
ExceptionDescription
\Zend_Log_Exception
methodpublicshutdown() : void

Sends mail to recipient(s) if log entries are present. Note that both plaintext and HTML portions of email are handled here.

Documentation was generated by phpDocumentor 2.2.0 .