Zend Framework  3.0
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Mail Class Reference

Class used for writing log messages to email via Zend. More...

Public Member Functions

 __construct ($mail, Transport\TransportInterface $transport=null)
 Constructor.
 
 setTransport (Transport\TransportInterface $transport)
 Set the transport message.
 
 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 AbstractWriter
 __construct ($options=null)
 Constructor.
 
 addFilter ($filter, array $options=null)
 Add a filter specific to this writer.
 
 getFilterPluginManager ()
 Get filter plugin manager.
 
 setFilterPluginManager ($plugins)
 Set filter plugin manager.
 
 filterPlugin ($name, array $options=null)
 Get filter instance.
 
 getFormatterPluginManager ()
 Get formatter plugin manager.
 
 setFormatterPluginManager ($plugins)
 Set formatter plugin manager.
 
 formatterPlugin ($name, array $options=null)
 Get formatter instance.
 
 write (array $event)
 Log a message to this writer.
 
 setFormatter ($formatter, array $options=null)
 Set a new formatter for this writer.
 
 setConvertWriteErrorsToExceptions ($convertErrors)
 Set convert write errors to exception flag.
 
 shutdown ()
 Perform shutdown activities such as closing open resources.
 
- Public Member Functions inherited from WriterInterface
 addFilter ($filter)
 Add a log filter to the writer.
 
 setFormatter ($formatter)
 Set a message formatter for the writer.
 

Protected Member Functions

 doWrite (array $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 empty string if none occurred.
 
- Protected Member Functions inherited from AbstractWriter
 getFormatter ()
 Get formatter.
 
 hasFormatter ()
 Check if the writer has a formatter.
 
 doWrite (array $event)
 Write a message to the log.
 

Protected Attributes

 $eventsToMail = []
 
 $mail
 
 $transport
 
 $numEntriesPerPriority = []
 
 $subjectPrependText
 
- Protected Attributes inherited from AbstractWriter
 $filterPlugins
 
 $formatterPlugins
 
 $filters = []
 
 $formatter
 
 $convertWriteErrorsToExceptions = true
 
 $errorsToExceptionsConversionLevel = E_WARNING
 

Detailed Description

Class used for writing log messages to email via Zend.

Allows for emailing log messages at and above a certain level via a Zend object. Note that this class only sends the email upon completion, so any log entries accumulated are sent in a single email. The email is sent using a Zend object (Sendmail is default).

Constructor & Destructor Documentation

__construct (   $mail,
Transport\TransportInterface  $transport = null 
)

Constructor.

Parameters
MailMessage | array | Traversable$mail
Transport\TransportInterface$transportOptional
Exceptions
Exception\InvalidArgumentException

Member Function Documentation

doWrite ( array  $event)
protected

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

Parameters
array$eventEvent data
getFormattedNumEntriesPerPriority ( )
protected

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

Returns
string
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 subject can only be set once, this method cannot be used if the Zend object already has a subject set.

Parameters
string$subjectSubject prepend text
Returns
Mail
setTransport ( Transport\TransportInterface  $transport)

Set the transport message.

Parameters
Transport\TransportInterface$transport
Returns
Mail
shutdown ( )

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

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

Implements WriterInterface.

Member Data Documentation

$eventsToMail = []
protected
$mail
protected
$numEntriesPerPriority = []
protected
$subjectPrependText
protected
$transport
protected