简体   繁体   English

Zend_Log的UML类图是否正确?

[英]Is UML Class Diagram of Zend_Log correct?

Background of question 问题的背景

Analysis of Zend_Log reveals following Class Diagram Zend_Log的分析揭示了以下类图

Zend_Log: Zend_Log进行:

  • uses ReflectionClass & Zend_Log_Exception 使用ReflectionClass和Zend_Log_Exception
  • maintains reference to array of Zend_Log_Writer_Abstract 维护对Zend_Log_Writer_Abstract数组的引用
  • maintains references to array of Zend_Log_Filter_Interface 维护对Zend_Log_Filter_Interface数组的引用

Zend_Log_Writer_Abstract Zend_Log_Writer_Abstract

  • maintains reference to array of Zend_Log_Filter_Interface 维护对Zend_Log_Filter_Interface数组的引用
  • maintains reference to Zend_Log_Formatter_Interface 维护对Zend_Log_Formatter_Interface的引用

替代文字

Questions 问题

  1. 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? Zend_Log_Filter_Interface与Zend_Log_Filter_Suppress,Zend_Log_Filter_Message和Zend_Log_Filter_Priority有关,如图所示,这是否在Class Diagram中正确布局?
  2. 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)? 可以这么说,Zend_Log包含对Zend_Log_Filter_Interface数组的引用,这是组合关系(类似于Zend_Log_Writer_Abstract)?
  3. 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); 很明显,Zend_Log_Filter_Interface包含在Zend_Log和Zend_Log_Writer_Abstract中,而Zend_Log包含Zend_Log_Writer_Abstract,这使Zend_Log_Filter被容器(Zend_Log)和包含(Zend_Log_Writer_Abstract)引用; is that some "Design Pattern", if yes what is the name? 是一些“设计模式”,如果是的话是什么名字?

Regards! 问候!

  1. Zend_Log_Filter_Suppress , Zend_Log_Filter_Message , and Zend_Log_Filter_Priority all implement the Zend_Log_Filter_Interface interface. Zend_Log_Filter_SuppressZend_Log_Filter_MessageZend_Log_Filter_Priority都实现了Zend_Log_Filter_Interface接口。 This is denoted using the empty arrow and dotted lines between them. 这用空箭头和它们之间的虚线表示。 The same is true for Zend_Log_Formatter_Interface and the three classes depicted below it. Zend_Log_Formatter_Interface和下面描述的三个类也是如此。

  2. Yes, that's correct. 对,那是正确的。 Whether to use an association (-->) or composition here could be debated since two Zend_Log instances could share a single Zend_Log_Writer_Db instance. 由于两个Zend_Log实例可以共享一个Zend_Log_Writer_Db实例,因此可以讨论是否在此使用关联( - >)或组合。 As the writers and filters determine the overall behavior of the log, composition makes sense to me. 由于编写器和过滤器决定了日志的整体行为,因此组合对我来说很有意义。

  3. 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 WARN priority (at the log level) which get written to a file and further limit database logging to those at the FATAL level. 这允许您忽略低于WARN优先级(在日志级别)的所有消息,这些消息将写入文件并进一步限制数据库日志记录到FATAL级别的数据库。 You could accomplish the same effect by dropping the log-level filter array, but it would require duplicating the filtering in each writer. 您可以通过删除日志级别的过滤器数组来实现相同的效果,但是它需要复制每个编写器中的过滤。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM