2008年9月23日星期二

[fw-core] Zend_Log factory() proposition

Hi,

I'd like to do a proposition for a factory method in the Zend_Log that allows easy creation and configuration of the Zend_Log object.

For example you have more than one logger and you want to be able to easily enable/disable the writers separately. Often we use multiple environments like staging, integration and production. ie. I want to write to a log file on production but disable the firePHP logging.

Now we have something like this in our config.ini file:

debug.log.file.class = "Zend_Log_Writer_Stream"
debug.log.file.config.uri = "/<path>/<to>/application.log"
debug.log.file.enabled = true
debug.log.firebug.class = "Zend_Log_Writer_Firebug"
debug.log.firebug.params = ""
debug.log.firebug.enabled = false

>From that we create a Zend_Config object and passes it to a factory method that will create the Zend_Log object.

If find myself doing this for every project and it would be nice if we could incorporate it in the Zend_Log itself. To make it work we need to change a little bit in the stream writer but it can be kept backwards compatible.

Its kinda similar to what is used with Zend_db.

I'd happy to build it and provide patches.


Let me know what you guys think.


Regards,
--
Ibuildings [i]
THE PHP PROFESSIONALS

Martin Roest
Professional Services Consultant
(Zend PHP5 Certified Engineer)
(MySQL 5 Certified Developer)


phone (direct): +31 (0) 88 00 24 059
mobile: +31 (0) 6 28 55 67 83
skype: mroest
e-mail: martin@ibuildings.nl

phone: +31 (0) 88 00 24 000
www.ibuildings.nl

To all agreements with Ibuildings.nl BV, our general terms and conditions apply.

没有评论: