Logger Plugin

The Logger plugins helps with debugging during the process of sending. It can help to identify why an SMTP server is rejecting addresses, or any other hard-to-find problems that may arise.

The Logger plugin comes in two parts. There's the plugin itself, along with one of a number of possible Loggers that you may choose to use. For example, the logger may output messages directly in realtime, or it may capture messages in an array.

One other notable feature is the way in which the Logger plugin changes Exception messages. If Exceptions are being thrown but the error message does not provide conclusive information as to the source of the problem (such as an ambiguous SMTP error) the Logger plugin includes the entire SMTP transcript in the error message so that debugging becomes a simpler task.

There are a few available Loggers included with Swift Mailer, but writing your own implementation is incredibly simple and is achieved by creating a short class that implements the Swift_Plugins_Logger interface.

Logger Class Description
Swift_Plugins_Loggers_ArrayLogger Keeps a collection of log messages inside an array. The array content can be cleared or dumped out to the screen.
Swift_Plugins_Loggers_EchoLogger Prints output to the screen in realtime. Handy for very rudimentary debug output.

NOTE: Documentation for version 3 is in the wiki.