public static function factory($config) { $options = self::_parseConfig($config); if (!isset($options['to'])) { // Note that the logging is configured wrongly... but we can't log that because, well... // the logging is configured wrongly... so we could crash and burn, but in this case that would be overkill, // so we silently ignore it... // Which may cause someone some headache down the road, but c'est la vie... return new Zend_Log_Writer_Null(); } $formatter = new EngineBlock_Log_Formatter_Mail($options['filterValues']); $writer = new self($options, $formatter); $writer->setSubjectPrependText('[SURFconext][EngineBlock][' . gethostname() . ']'); if (isset($options['filterName'])) { // has underscores if (strpos($options['filterName'], '_') !== false) { $className = 'Zend_Log_Filter_' . $options['filterName']; } else { $className = $options['filterName']; } $filter = new $className($options['filterParams']); $writer->addFilter($filter); } return $writer; }
/** * Create a new instance of Zend_Log_Writer_Mail * * @param array|Zend_Config $config * @return Zend_Log_Writer_Mail */ public static function factory($config) { $config = self::_parseConfig($config); $mail = self::_constructMailFromConfig($config); $writer = new self($mail); if (isset($config['layout']) || isset($config['layoutOptions'])) { $writer->setLayout($config); } if (isset($config['layoutFormatter'])) { $layoutFormatter = new $config['layoutFormatter'](); $writer->setLayoutFormatter($layoutFormatter); } if (isset($config['subjectPrependText'])) { $writer->setSubjectPrependText($config['subjectPrependText']); } return $writer; }