SMTP appender: use patternLayout for email subject #191

Open
wants to merge 1 commit into
from

Projects

None yet

2 participants

@paypac
paypac commented Mar 25, 2014

This pull request changes the handling of the SMTP 'subject' option to use patternLayout instead of messagePassThroughLayout.

This means you can specify an appender like:

appender: {
    type: 'smtp',
    recipients: 'errors@company.com',
    subject: '%p on %h: %m'
}

Which will produce email subjects like: "ERROR on DEV-BOX03: foo is not a valid widget"

Apart from enabling pattern specifiers (%m etc), it works exactly as before:

  • if subject is not specified, the subject will contain the first log message
  • if a literal subject string is specified (eg, 'ERROR! please investgate...') it will be used verbatim
paypac change subject layout to allow patterns
subject uses patternLayout instead of messagePassThroughLayout
04730cc
@nomiddlename
Owner

Hi, looks like this change breaks a few existing tests (according to the travis build). Could you take a look, please? And also add some tests to cover your change. Use "npm test" to run the test suite.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment