Agavi Logging
As a proof of concept I have put together some code for logging. The point of this is to form the
basis of discussion, it is not sufficiently robust to enter the framework 'as is'. However it does (I
believe) provide sufficient functionality to be the basis of discussion.
There is nothing particularly special about the code, I have tried to follow the essence of the
framework, however it does lack proper error checking (exceptions) unit tests are missing, no
proper docs and the actual logging functionality is missing – rather the logging just goes to the
screen. The main reason for these deficiencies is because I wanted to focus on the concept and get
feedback on that first.
Framework classes
The framework classes used are as follows:
LoggerManager This singleton class will manage the logger objects
LoggingConfigHandler This class will extract the information form the *.ini file.
Logger This class is an abstract class that provides the basic logging functionality. It will check if it needs to respond to a log request.
FileLogger, EmailLogger and HTMLLogger These are child classes of Logger. These classes will write out the log to the appropriate location NOT IMPLEMENTED – at the moment it will just echo out the message.
Using the classes
The LoggerManager object can be set up in the index.php file, meaning that the logging can be used
almost immediately. It can be set up once the agavi.php file has been included.
The config_handlers.ini file has been modified to include a logging.ini entry.
A logging.ini file is included
I then tested it with the following line of code in the IndexAction, of the Default module.
    LoggerManager::write("Error in handleError() method of IndexAction.class.php",HIGH);
Conclusion
This is essentially presented to you all for comments.

graeme.

Attachment: loggingPOC.tar.gz
Description: Binary data

_______________________________________________
agavi-dev mailing list
[email protected]
http://labworkz.com/cgi-bin/mailman/listinfo/agavi-dev

Reply via email to