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\Message 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\Mail\Transport\TransportInterface object (Sendmail is default).

category Zend
package Zend_Log
subpackage Writer

 Methods

Constructor

__construct(\Zend\Mail\Message | array | \Traversable $mail, \Zend\Mail\Transport\TransportInterface $transport) 

Parameters

$mail

\Zend\Mail\Messagearray\Traversable

Exceptions

\Zend\Log\Exception\InvalidArgumentException

Add a filter specific to this writer.

addFilter(int | string | \Zend\Log\Filter\FilterInterface $filter, array $options) : \Zend\Log\Writer\AbstractWriter
Inherited

inherited_from \Zend\Log\Writer\AbstractWriter::addFilter()

Parameters

$options

arraynull

Exceptions

\Zend\Log\Exception\InvalidArgumentException

Returns

Get filter instance

filterPlugin(string $name, array $options) : \Zend\Log\Filter\FilterInterface
Inherited

inherited_from \Zend\Log\Writer\AbstractWriter::filterPlugin()

Parameters

$name

string

$options

arraynull

Returns

Get filter plugin manager

getFilterPluginManager() : \Zend\Log\Writer\FilterPluginManager
Inherited

inherited_from \Zend\Log\Writer\AbstractWriter::getFilterPluginManager()

Returns

Set convert write errors to exception flag

setConvertWriteErrorsToExceptions($convertErrors) 
Inherited

inherited_from \Zend\Log\Writer\AbstractWriter::setConvertWriteErrorsToExceptions()

Parameters

$convertErrors

Set filter plugin manager

setFilterPluginManager(string | \Zend\Log\Writer\FilterPluginManager $plugins) : \Zend\Log\Writer\self
Inherited

inherited_from \Zend\Log\Writer\AbstractWriter::setFilterPluginManager()

Parameters

Exceptions

\Zend\Log\Exception\InvalidArgumentException

Returns

\Zend\Log\Writer\self

Set a new formatter for this writer

setFormatter(\Zend\Log\Formatter\FormatterInterface $formatter) : \Zend\Log\Writer\self
Inherited

inherited_from \Zend\Log\Writer\AbstractWriter::setFormatter()

Parameters

Returns

\Zend\Log\Writer\self

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

setSubjectPrependText(string $subject) : \Zend\Log\Writer\Mail

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

Parameters

$subject

string

Subject prepend text

Returns

Set the transport message

setTransport(\Zend\Mail\Transport\TransportInterface $transport) : \Zend\Log\Writer\Mail

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

shutdown() : void

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

Log a message to this writer.

write(array $event) : void
Inherited

inherited_from \Zend\Log\Writer\AbstractWriter::write()

Parameters

$event

array

log data event

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

doWrite(array $event) : void

Parameters

$event

array

Event data

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

getFormattedNumEntriesPerPriority() : string

Returns

string

 Properties

 

Use Zend\Stdlib\ErrorHandler to report errors during calls to write

$convertWriteErrorsToExceptions : bool
Inherited

inherited_from \Zend\Log\Writer\AbstractWriter::$$convertWriteErrorsToExceptions
 

Error level passed to Zend\Stdlib\ErrorHandler::start for errors reported during calls to write

$errorsToExceptionsConversionLevel : bool
Inherited

inherited_from \Zend\Log\Writer\AbstractWriter::$$errorsToExceptionsConversionLevel
 

Array of formatted events to include in message body.

$eventsToMail : array

 

Filter plugins

$filterPlugins : \Zend\Log\Writer\FilterPluginManager
Inherited

inherited_from \Zend\Log\Writer\AbstractWriter::$$filterPlugins
 

Filter chain

$filters : \Zend\Log\Filter\FilterInterface[]
Inherited

inherited_from \Zend\Log\Writer\AbstractWriter::$$filters
 

Formats the log message before writing

$formatter : \Zend\Log\Formatter\FormatterInterface
Inherited

inherited_from \Zend\Log\Writer\AbstractWriter::$$formatter
 

Mail message instance to use

$mail : \Zend\Mail\Message

 

Array keeping track of the number of entries per priority level.

$numEntriesPerPriority : array

 

Subject prepend text.

$subjectPrependText : string | null

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.

 

Mail transport instance to use; optional.

$transport : \Zend\Mail\Transport\TransportInterface