Issues

ZF-9990: Zend_Log_Writer_Mail : implement factory()

Description

Implement the factory method for the class Zend_Log_Writer_Mail in order to configure all writers of Zend_Log with a Zend_Config.

Comments

my personal implementation patch. Benoit, i didn't stopped writing tests, if you want you can assing to me.

attached my local changes that implements this issue and its tests, all green ;-) i will wait until next week before i assign this issue to me and commit to trunk

It's a generic approach to allow every setters ^^ It lacks a configuration setting for the method setSubjectPreprendText() for me. I think this feature should allow multiple recipients. This should be possible by providing an array for the header To, and the fact that we can define an array in an application configuration.

I am surprised that the unit tests contain any assertion.

yes Benoit, it's a generic setter

about writer configuration you are right, current solution allow us to configure mail object, but it doesn't allow to configure log writer object, it needs to be fixed

about multiple recipients i think you are right again, it should allow set multiple recipients

forget the current solution, let's try solve this starting from usage, could this piece of application.ini file bellow a nice way to represent your wishes?

resources.log.mail.writerName = "Mail" resources.log.mail.writerParams.layout = "Zend_Layout" resources.log.mail.writerParams.layoutOptions[] = resources.log.mail.writerParams.mail = "Zend_Mail" resources.log.mail.writerParams.subjectPrepend = "[error] " resources.log.mail.writerParams.from = "system@domain" resources.log.mail.writerParams.to[] = "admin1@domain" resources.log.mail.writerParams.to[] = "admin2@domain" resources.log.mail.writerParams.cc[] = "admin3@domain" resources.log.mail.writerParams.cc[] = "admin4@domain" resources.log.mail.writerParams.bcc[] = "admin5@domain" resources.log.mail.writerParams.ccc[] = "admin6@domain"

what do you think about?

Renan, here are some uses with comments that I think: resources.log.mail.writerName = "Mail"

resources.log.mail.writerParams.layout = "Zend_Layout" resources.log.mail.writerParams.layoutOptions[] = (optional)

resources.log.mail.writerParams.mail = "Zend_Mail" (optional)

resources.log.mail.writerParams.charset = "utf-8" (may be add a method Zend_Mail::addCharset() is an other issue or with the constuctor of the mail class)

resources.log.mail.writerParams.subjectPrepend = "[error] " or resources.log.mail.writerParams.subject = "error on domain"

resources.log.mail.writerParams.from.email = "system@domain" resources.log.mail.writerParams.from.name = "syslog" (someone can want to define a name)

resources.log.mail.writerParams.to[] = "admin1@domain" resources.log.mail.writerParams.to[] = "admin2@domain" resources.log.mail.writerParams.cc[] = "admin3@domain" resources.log.mail.writerParams.cc[] = "admin4@domain" resources.log.mail.writerParams.bcc[] = "admin5@domain" (ok)

resources.log.mail.writerParams.ccc[] = "admin6@domain" What is 'ccc' ?

Hi Ralph

See that this improvement is dependent ZF-4955.

I add a new key : resources.log.mail.layoutFormatter = "Zend_Log_Formatter_Simple"

Patch, unit tests, doc en and fr

r22962