Re: Request For Comments: Log2
| From: | David Jean Louis | Date: | Sun, 13 Sep 2009 20:23:26 +0000 |
| Subject: | Re: Request For Comments: Log2 | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-52805@lists.php.net to get a copy of this message | ||
Hi Brandon,
All, I spent the weekend implementing a logging class that is based on (but does not implement the API of) the Log class in PEAR. I've completed my initial code writing, and I'd like comments. At the moment, there is no documentation. That is next on my agenda. However, you can browse the code here: http://log2.brandonsavage.net/log2 I've run the code through CodeSniffer and run my unit tests against it, so I think it's largely bug free, but it's always possible that I missed something. Also, suggestions from the community are greatly appreciated.While I think having a php5 Log2 package that can run with E_STRICT is a very good idea, the code is really far from PEAR::Log in terms of features / flexibility / correctness, just a few points: * interface is not unified (see the Mail driver for example), it is a very bad idea to code driver specific public methods or parameters (what if i change the driver ? do i have to comment those method calls ? change the way i instanciate the driver ? no, the only thing i should have to change is the driver name and maybe some options in an array) * no way to log to console or syslog: this is definitively needed for a log package * no log level masks: this is also needed, it's really helpful * no way to configure the log format (and the date format) * lack of options in drivers: file permissions for the File driver, subject prefix in the mail driver, etc... * no file locking * no shortcuts methods (emerg(), warn()...) * etc... PEAR::Log (even if it's php4) is really well written, well documented[1] and has more than 8 years of debug / user feedback[2], you should really borrow most of the code from it and adapt it to php5. But before that, i think it would be fair to contact Jon Parise (the author of PEAR::Log, maybe you did ?), see what he thinks of the idea and possibly work with him (or ask him to mentor you) to bring a super php5 Log2 package ;) Clearly, my intent is not discourage you on this, i'm just giving you my first impressions :) Cheers ! -- David [1] http://www.indelible.org/php/Log/guide.html [2] http://pear.php.net/bugs/search.php?cmd=display&package_name[]=Log&status=All