Background of question
Analysis of Zend_Log reveals following Class Diagram
- uses ReflectionClass & Zend_Log_Exception
- maintains reference to array of Zend_Log_Writer_Abstract
- maintains references to array of Zend_Log_Filter_Interface
- maintains reference to array of Zend_Log_Filter_Interface
- maintains reference to Zend_Log_Formatter_Interface
- Zend_Log_Filter_Interface relates with Zend_Log_Filter_Suppress, Zend_Log_Filter_Message & Zend_Log_Filter_Priority as depicted, is this correctly laid out in Class Diagram?
- Is it okay to say that, the Zend_Log contains reference to array of Zend_Log_Filter_Interface and this is composition relationship (similarly for Zend_Log_Writer_Abstract)?
- As it is obvious that Zend_Log_Filter_Interface is contained by both Zend_Log & Zend_Log_Writer_Abstract, while Zend_Log contains Zend_Log_Writer_Abstract, that makes Zend_Log_Filter referenced by both container (Zend_Log) and contained (Zend_Log_Writer_Abstract); is that some "Design Pattern", if yes what is the name?
Zend_Log_Filter_Priorityall implement the
Zend_Log_Filter_Interfaceinterface. This is denoted using the empty arrow and dotted lines between them. The same is true for
Zend_Log_Formatter_Interfaceand the three classes depicted below it.
Yes, that's correct. Whether to use an association (-->) or composition here could be debated since two
Zend_Loginstances could share a single
Zend_Log_Writer_Dbinstance. As the writers and filters determine the overall behavior of the log, composition makes sense to me.
Each log instance can write to multiple writers. Messages are first filtered by the log itself, and any message that passes goes to every writer. Each writer filters the incoming messages as well. This allows you to ignore all messages below the
WARNpriority (at the log level) which get written to a file and further limit database logging to those at the
FATALlevel. You could accomplish the same effect by dropping the log-level filter array, but it would require duplicating the filtering in each writer.