Exemplo n.º 1
0
 public function testFactory()
 {
     $cfg = array('log' => array('memory' => array('writerName' => "Null")));
     require_once 'Zend/Log.php';
     $logger = Zend_Log::factory($cfg['log']);
     $this->assertTrue($logger instanceof Zend_Log);
 }
Exemplo n.º 2
0
 /**
  * 记录日志(等级,消息,文件前缀-分组)
  * Enter description here ...
  * @param $level
  * @param $message
  * @param $filename
  */
 function log($level, $message, $filename = 'application')
 {
     require_once 'Zend/Log.php';
     @mkdir(APPPATH . './logs/' . substr($filename, 0, strrpos($filename, '/')), 0777, 1);
     $logger = Zend_Log::factory(array('timestampFormat' => 'Y-m-d H:i:s', array('writerName' => 'Stream', 'writerParams' => array('stream' => APPPATH . '/logs/' . $filename . '-' . date('Y-m-d') . '.log'), 'formatterName' => 'Simple', 'formatterParams' => array('format' => '%timestamp%: %message%' . PHP_EOL), 'filterName' => 'Priority', 'filterParams' => array('priority' => Zend_Log::DEBUG))));
     $logger->log($message, $level);
 }
Exemplo n.º 3
0
 /**
  * Retrieve translate object
  *
  * @return Zend_Translate
  * @throws Zend_Application_Resource_Exception if registry key was used
  *          already but is no instance of Zend_Translate
  */
 public function getTranslate()
 {
     if (null === $this->_translate) {
         $options = $this->getOptions();
         if (!isset($options['content']) && !isset($options['data'])) {
             require_once LIB_DIR . '/Zend/Application/Resource/Exception.php';
             throw new Zend_Application_Resource_Exception('No translation source data provided.');
         } else {
             if (array_key_exists('content', $options) && array_key_exists('data', $options)) {
                 require_once LIB_DIR . '/Zend/Application/Resource/Exception.php';
                 throw new Zend_Application_Resource_Exception('Conflict on translation source data: choose only one key between content and data.');
             }
         }
         if (empty($options['adapter'])) {
             $options['adapter'] = Zend_Translate::AN_ARRAY;
         }
         if (!empty($options['data'])) {
             $options['content'] = $options['data'];
             unset($options['data']);
         }
         if (isset($options['log'])) {
             if (is_array($options['log'])) {
                 $log = Zend_Log::factory($options['log']);
             }
             if ($log instanceof Zend_Log) {
                 $options['log'] = $log;
             }
         }
         if (isset($options['options'])) {
             foreach ($options['options'] as $key => $value) {
                 $options[$key] = $value;
             }
         }
         if (!empty($options['cache']) && is_string($options['cache'])) {
             $bootstrap = $this->getBootstrap();
             if ($bootstrap instanceof Zend_Application_Bootstrap_ResourceBootstrapper && $bootstrap->hasPluginResource('CacheManager')) {
                 $cacheManager = $bootstrap->bootstrap('CacheManager')->getResource('CacheManager');
                 if (null !== $cacheManager && $cacheManager->hasCache($options['cache'])) {
                     $options['cache'] = $cacheManager->getCache($options['cache']);
                 }
             }
         }
         $key = isset($options['registry_key']) && !is_numeric($options['registry_key']) ? $options['registry_key'] : self::DEFAULT_REGISTRY_KEY;
         unset($options['registry_key']);
         if (Zend_Registry::isRegistered($key)) {
             $translate = Zend_Registry::get($key);
             if (!$translate instanceof Zend_Translate) {
                 require_once LIB_DIR . '/Zend/Application/Resource/Exception.php';
                 throw new Zend_Application_Resource_Exception($key . ' already registered in registry but is ' . 'no instance of Zend_Translate');
             }
             $translate->addTranslation($options);
             $this->_translate = $translate;
         } else {
             $this->_translate = new Zend_Translate($options);
             Zend_Registry::set($key, $this->_translate);
         }
     }
     return $this->_translate;
 }
Exemplo n.º 4
0
 /**
  * Returns a singelton logger instance.
  * 
  * @return Zend_Log
  */
 public static function getInstance()
 {
     if (self::$_instance === null) {
         $config = Zend_Registry::get('config');
         self::$_instance = Zend_Log::factory(array(array('writerName' => 'Stream', 'writerParams' => array('stream' => 'php://output'), 'filterName' => 'Priority', 'filterParams' => array('priority' => constant('Zend_Log::' . $config->log->level)))));
     }
     return self::$_instance;
 }
Exemplo n.º 5
0
 public function getLog()
 {
     if (null === $this->_log) {
         $options = $this->getOptions();
         $log = Zend_Log::factory($options);
         $this->setLog($log);
     }
     return $this->_log;
 }
Exemplo n.º 6
0
 /**
  * Shortcut to fetching a configured logger instance
  *
  * @param  array|Zend_Config $config Array or instance of Zend_Config
  * @return Zend_Log
  */
 public static function factory($config = array())
 {
     if (is_string($config)) {
         // Assume $config is a filename
         $filename = $config;
         $config = array('timestampFormat' => 'Y-m-d', array('writerName' => 'Stream', 'writerParams' => array('stream' => self::_getLoggingDirectory() . DIRECTORY_SEPARATOR . $filename)));
     }
     return parent::factory($config);
 }
Exemplo n.º 7
0
 /**
  * Build a log object used internally by parent class
  *
  * @return void
  */
 protected function buildLog()
 {
     if (isset($this->_options['log'])) {
         if (is_array($this->_options['log'])) {
             $this->_options['log'] = Zend_Log::factory($this->_options['log']);
         } else {
             unset($this->_options['log']);
         }
     }
 }
Exemplo n.º 8
0
 public function testFactory()
 {
     $cfg = array('log' => array('memory' => array('writerName' => "Mock", 'filterName' => "Priority", 'filterParams' => array('priority' => "Zend_Log::CRIT", 'operator' => "<="))));
     $logger = Zend_Log::factory($cfg['log']);
     $this->assertTrue($logger instanceof Zend_Log);
     try {
         $logger = Zend_Log::factory(array('Null' => array('writerName' => 'Mock', 'filterName' => 'Priority', 'filterParams' => array())));
     } catch (Exception $e) {
         $this->assertType('Zend_Log_Exception', $e);
         $this->assertRegExp('/must be an integer/', $e->getMessage());
     }
 }
Exemplo n.º 9
0
 public function getLogs()
 {
     if (null === $this->_logs) {
         $options = $this->getOptions();
         foreach ($options as $key => $opt) {
             // Detect if we are only giving one writer
             if (0 === strpos(key($opt), 'writerN')) {
                 $opt = array($key => $opt);
             }
             $log = Zend_Log::factory($opt);
             $this->addLog($key, $log);
         }
     }
     return $this->_logs;
 }
Exemplo n.º 10
0
 public function getLog()
 {
     if (null === $this->_log) {
         $options = $this->getOptions();
         foreach ($options as $key => $writer) {
             if ($writer['writerName'] == "Db" && is_array($writer['writerParams']['db'])) {
                 $params = $writer['writerParams']['db'];
                 $options[$key]['writerParams']['db'] = Zend_Db::factory($params['adapter'], $params);
             }
         }
         $log = Zend_Log::factory($options);
         $log->setTimestampFormat('Y-m-d H:i:s');
         $this->setLog($log);
     }
     return $this->_log;
 }
Exemplo n.º 11
0
 protected function _initLog()
 {
     // Sandra SSSSS este função tem que ficar comentada em produção - para não ficar criando arquivos de log  desnecessariamente
     $options = $this->getOption('resources');
     $partitionConfig = $this->getOption('log');
     $logOptions = $options['log'];
     $baseFilename = $logOptions['stream']['writerParams']['stream'];
     if ($partitionConfig['partitionStrategy'] == 'context') {
         $baseFilename = $partitionConfig['path'] . '/' . APPLICATION_ENV;
     }
     $logFilename = $baseFilename . '_' . date('Y_W');
     //semanalmente
     $logOptions['stream']['writerParams']['stream'] = $logFilename;
     $logger = Zend_Log::factory($logOptions);
     Zend_Registry::set('logger', $logger);
     return $logger;
 }
Exemplo n.º 12
0
 /**
  * 初始化Log
  *
  * @return Zend_Log
  */
 public function _initLog()
 {
     $configs = $this->_options['resources']['log'];
     foreach ($configs as $key => &$config) {
         $params =& $config['writerParams'];
         if (strtolower($key) == 'db') {
             if (!empty($params['db']) && !empty($params['table'])) {
                 $params['db'] = $this->getResource('multidb')->getDb($params['db']);
                 $params['columnMap'] = array('SEVERITY' => 'priority', 'ORIGIN' => 'from', 'DATA' => 'data', 'MESSAGE' => 'message');
             } else {
                 unset($configs[$key]);
             }
         }
     }
     $logger = Zend_Log::factory($configs);
     return $logger;
 }
Exemplo n.º 13
0
 public static function getLogger()
 {
     if (Zend_Registry::isRegistered(self::LOGGER)) {
         return Zend_Registry::get(self::LOGGER);
     }
     $config = new Zend_Config_Ini(ROOT_PATH . '/config/log.ini');
     $config = $config->toArray();
     $date = new Zend_Date();
     $part = "YYYY-MM-dd";
     $fileName = $config[0]['writerParams']['stream'];
     $ext = substr($fileName, -4);
     $fileName = substr($fileName, 0, -4);
     $fileName = $fileName . "_" . $date->get($part) . $ext;
     $config[0]['writerParams']['stream'] = $fileName;
     $logger = Zend_Log::factory($config);
     Zend_Registry::set(self::LOGGER, $logger);
     return $logger;
 }
Exemplo n.º 14
0
 /**
  * Retrieve Zend_Cache_Manager instance
  *
  * @return Zend_Cache_Manager
  */
 public function getCacheManager()
 {
     if (null === $this->_manager) {
         $this->_manager = new Zend_Cache_Manager();
         $options = $this->getOptions();
         foreach ($options as $key => $value) {
             // Logger
             if (isset($value['frontend']['options']['logger'])) {
                 $logger = $value['frontend']['options']['logger'];
                 if (is_array($logger)) {
                     $value['frontend']['options']['logger'] = Zend_Log::factory($logger);
                 }
             }
             // Cache templates
             if ($this->_manager->hasCacheTemplate($key)) {
                 $this->_manager->setTemplateOptions($key, $value);
             } else {
                 $this->_manager->setCacheTemplate($key, $value);
             }
         }
     }
     return $this->_manager;
 }
Exemplo n.º 15
0
 /**
  * 
  * @param ZtChart_Model_Monitor_Console $console
  * @param array $config
  */
 public function __construct(ZtChart_Model_Monitor_Console $console, $config = array())
 {
     $this->_console = $console;
     foreach ($config as $name => $value) {
         $method = 'set' . ucfirst($name);
         if (method_exists($this, $method)) {
             $method($value);
         }
     }
     if (null === $this->_db) {
         $this->_db = self::$_defaultDb;
     }
     if (null === $this->_logger) {
         $this->_logger = Zend_Log::factory(array(array('writerName' => 'Stream', 'writerParams' => array('stream' => 'php://stderr'), 'filterName' => 'Priority', 'filterParams' => array('priority' => Zend_Log::ERR, 'operator' => '<=')), array('writerName' => 'Stream', 'writerParams' => array('stream' => 'php://stdout'), 'filterName' => 'Priority', 'filterParams' => array('priority' => Zend_Log::INFO))));
     }
 }
Exemplo n.º 16
0
 public function testFactory()
 {
     $cfg = array('log' => array('memory' => array('writerName' => "Mock", 'filterName' => "Suppress")));
     $logger = Zend_Log::factory($cfg['log']);
     $this->assertTrue($logger instanceof Zend_Log);
 }
Exemplo n.º 17
0
if (!isset($version)) {
    if (Zend_Registry::get('configDatabase')->database->adapter === 'PDO_MYSQL') {
        $type = 'mysql';
    } elseif (Zend_Registry::get('configDatabase')->database->adapter === 'PDO_PGSQL') {
        $type = 'pgsql';
    } elseif (Zend_Registry::get('configDatabase')->database->adapter === 'PDO_SQLITE') {
        $type = 'sqlite';
    } else {
        echo 'Error';
        exit;
    }
    $MyDirectory = opendir(BASE_PATH . '/core/database/' . $type);
    while ($Entry = @readdir($MyDirectory)) {
        if (strpos($Entry, '.sql') != false) {
            $sqlFile = BASE_PATH . '/core/database/' . $type . '/' . $Entry;
        }
    }
    $version = str_replace('.sql', '', basename($sqlFile));
}
$upgradeComponent->upgrade($version, true);
$logger = Zend_Log::factory(array(array('writerName' => 'Stream', 'writerParams' => array('stream' => LOGS_PATH . '/testing.log'), 'filterName' => 'Priority', 'filterParams' => array('priority' => Zend_Log::INFO))));
Zend_Registry::set('logger', $logger);
if (file_exists(BASE_PATH . '/tests/configs/lock.mysql.ini')) {
    rename(BASE_PATH . '/tests/configs/lock.mysql.ini', BASE_PATH . '/tests/configs/mysql.ini');
}
if (file_exists(BASE_PATH . '/tests/configs/lock.pgsql.ini')) {
    rename(BASE_PATH . '/tests/configs/lock.pgsql.ini', BASE_PATH . '/tests/configs/pgsql.ini');
}
if (file_exists(BASE_PATH . '/tests/configs/lock.sqlite.ini')) {
    rename(BASE_PATH . '/tests/configs/lock.sqlite.ini', BASE_PATH . '/tests/configs/sqlite.ini');
}
Exemplo n.º 18
0
 /**
  * @group ZF-10990
  */
 public function testFactoryShouldKeepDefaultTimestampFormat()
 {
     $config = array('timestampFormat' => '', 'mock' => array('writerName' => 'Mock'));
     $logger = Zend_Log::factory($config);
     $this->assertEquals('c', $logger->getTimestampFormat());
 }
Exemplo n.º 19
0
 /**
  * Load the configuration files into the Zend registry.
  *
  * @return Zend_Config_Ini configuration file
  * @throws Zend_Exception
  */
 protected function _initConfig()
 {
     // init language
     $configGlobal = new Zend_Config_Ini(APPLICATION_CONFIG, 'global', true);
     if (isset($_COOKIE[MIDAS_LANGUAGE_COOKIE_NAME])) {
         $configGlobal->application->lang = $_COOKIE[MIDAS_LANGUAGE_COOKIE_NAME];
     }
     if (isset($_GET['lang'])) {
         $language = $_GET['lang'];
         if ($language !== 'en' && $language !== 'fr') {
             $language = 'en';
         }
         $configGlobal->application->lang = $language;
         $date = new DateTime();
         $interval = new DateInterval('P1M');
         setcookie(MIDAS_LANGUAGE_COOKIE_NAME, $language, $date->add($interval)->getTimestamp(), '/', !empty($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME'], (int) $configGlobal->get('cookie_secure', 1) === 1, true);
     }
     Zend_Registry::set('configGlobal', $configGlobal);
     $configCore = new Zend_Config_Ini(CORE_CONFIG, 'global', true);
     Zend_Registry::set('configCore', $configCore);
     // check if internationalization enabled
     if (isset($configCore->internationalization) && $configCore->internationalization == '0') {
         $configGlobal->application->lang = 'en';
     }
     $config = new Zend_Config_Ini(APPLICATION_CONFIG, $configGlobal->environment, true);
     Zend_Registry::set('config', $config);
     date_default_timezone_set($configGlobal->default->timezone);
     // InitDatabase
     $configDatabase = new Zend_Config_Ini(DATABASE_CONFIG, $configGlobal->environment, true);
     if (empty($configDatabase->database->params->driver_options)) {
         $driverOptions = array();
     } else {
         $driverOptions = $configDatabase->database->params->driver_options->toArray();
     }
     if ($configDatabase->database->adapter == 'PDO_SQLITE') {
         $params = array('dbname' => $configDatabase->database->params->dbname, 'driver_options' => $driverOptions);
     } else {
         if ($configDatabase->database->adapter == 'PDO_MYSQL') {
             $driverOptions[PDO::MYSQL_ATTR_USE_BUFFERED_QUERY] = true;
         }
         $params = array('dbname' => $configDatabase->database->params->dbname, 'username' => $configDatabase->database->params->username, 'password' => $configDatabase->database->params->password, 'driver_options' => $driverOptions);
         if (empty($configDatabase->database->params->unix_socket)) {
             $params['host'] = $configDatabase->database->params->host;
             $params['port'] = $configDatabase->database->params->port;
         } else {
             $params['unix_socket'] = $configDatabase->database->params->unix_socket;
         }
     }
     $db = Zend_Db::factory($configDatabase->database->adapter, $params);
     Zend_Db_Table::setDefaultAdapter($db);
     Zend_Registry::set('dbAdapter', $db);
     Zend_Registry::set('configDatabase', $configDatabase);
     // Init log
     if ($configGlobal->environment == 'production') {
         Zend_Loader_Autoloader::getInstance()->suppressNotFoundWarnings(true);
         $priority = Zend_Log::WARN;
     } else {
         Zend_Loader_Autoloader::getInstance()->suppressNotFoundWarnings(false);
         $priority = Zend_Log::DEBUG;
     }
     if (is_writable(LOGS_PATH)) {
         $stream = LOGS_PATH . '/' . $configGlobal->environment . '.log';
         $logger = Zend_Log::factory(array(array('writerName' => 'Stream', 'writerParams' => array('stream' => $stream), 'formatterName' => 'Simple', 'filterName' => 'Priority', 'filterParams' => array('priority' => $priority))));
     } else {
         $logger = Zend_Log::factory(array(array('writerName' => 'Syslog', 'formatterName' => 'Simple', 'filterName' => 'Priority', 'filterParams' => array('priority' => $priority))));
     }
     if (file_exists(LOCAL_CONFIGS_PATH . '/database.local.ini')) {
         $columnMapping = array('priority' => 'priority', 'message' => 'message', 'module' => 'module');
         $writer = new Zend_Log_Writer_Db($db, 'errorlog', $columnMapping);
         if ($configGlobal->environment == 'production') {
             $priority = Zend_Log::INFO;
         } else {
             $priority = Zend_Log::DEBUG;
         }
         $filter = new Zend_Log_Filter_Priority($priority);
         $writer->addFilter($filter);
         $logger->addWriter($writer);
     }
     $logger->setEventItem('module', 'core');
     $logger->registerErrorHandler();
     Zend_Registry::set('logger', $logger);
     // Init error handler
     require_once BASE_PATH . '/core/controllers/components/NotifyErrorComponent.php';
     $notifyErrorComponent = new NotifyErrorComponent();
     ini_set('display_errors', 0);
     register_shutdown_function(array($notifyErrorComponent, 'fatalError'), $logger);
     set_error_handler(array($notifyErrorComponent, 'warningError'), E_NOTICE | E_WARNING);
     return $config;
 }
Exemplo n.º 20
0
 public function testFactoryUrl()
 {
     $cfg = array('log' => array('memory' => array('writerName' => "Mock", 'writerParams' => array('url' => 'http://localhost', 'mode' => 'a'))));
     $logger = Zend_Log::factory($cfg['log']);
     $this->assertTrue($logger instanceof Zend_Log);
 }
Exemplo n.º 21
0
 function cancelsLogger()
 {
     if (isset($this->logger)) {
         return $this->logger;
     }
     $this->logger = Zend_Log::factory(array('timestampFormat' => 'Y-m-d h:i a', array('writerName' => 'Stream', 'writerParams' => array('stream' => 'var/cancels.log'), 'formatterName' => 'Simple', 'formatterParams' => array('format' => '%timestamp%: %message% -- %info%'))));
     return $this->logger;
 }
Exemplo n.º 22
0
 /**
  *
  */
 public function getLogger()
 {
     if (null === $this->_logger) {
         if (null === $this->_configs || !isset($this->_configs['log'])) {
             require_once dirname(__FILE__) . '/Exception.php';
             throw new Task_Exception("Logger config is null");
         }
         $configs = $this->_configs['log'];
         foreach ($configs as $key => &$config) {
             if ($key == 'debug') {
                 continue;
             }
             $params =& $config['writerParams'];
             if (strtolower($key) == 'db') {
                 if (!empty($params['db']) && !empty($params['table'])) {
                     $multidb = $this->_configs['multidb'];
                     $params['db'] = Zend_Db::factory($multidb[$params['db']]['adapter'], $multidb[$params['db']]['params']);
                     $params['columnMap'] = array('SEVERITY' => 'priority', 'ORIGIN' => 'from', 'MESSAGE' => 'message');
                 } else {
                     unset($configs[$key]);
                 }
             }
         }
         unset($configs['debug']);
         $this->_logger = Zend_Log::factory($configs);
     }
     return $this->_logger;
 }
Exemplo n.º 23
0
 public function testFactoryUsesNameAndNamespaceWithoutModifications()
 {
     $cfg = array('log' => array('memory' => array('writerName' => "ZendMonitor", 'writerNamespace' => "Zend_Log_Writer")));
     $logger = Zend_Log::factory($cfg['log']);
     $this->assertTrue($logger instanceof Zend_Log);
 }
Exemplo n.º 24
0
 /**
  *  Writes messages of several levels into configured log.
  *
  *  @param string  $message Message to write into log
  *  @param integer $level   Level of log entry
  *
  *  @access public
  *  @return void
  */
 protected function log($message, $level)
 {
     $class = get_class($this);
     $message = $class . ' (' . $this->name . ') ' . $message;
     $logger = Zend_Log::factory(array($this->logWriter));
     $logger->addPriority('SUC', 8);
     switch ($level) {
         case self::LOG_SUCCESS:
             $logger->log($message, 8);
             break;
         case self::LOG_FAILURE:
             $logger->log($message, 3);
             break;
         case self::LOG_EXCEPTION:
             $logger->log($message, 0);
             break;
     }
 }
Exemplo n.º 25
0
 public function testFactory()
 {
     $cfg = array('log' => array('memory' => array('writerName' => "Db", 'writerParams' => array('db' => $this->db, 'table' => $this->tableName))));
     require_once 'Zend/Log.php';
     $logger = Zend_Log::factory($cfg['log']);
     $this->assertTrue($logger instanceof Zend_Log);
 }
Exemplo n.º 26
0
 /**
  * Generic Log constructor
  *
  * @throws \Exception
  * @return Log
  */
 protected static function initLog()
 {
     if (!\Zend_Registry::isRegistered(Constants::CZE_LOG)) {
         if (isset(static::$config['log'])) {
             $log = \Zend_Log::factory(static::$config['log']);
             \Zend_Registry::set(Constants::CZE_LOG, $log);
         } else {
             throw new \Exception('Log configuration not found, aborting');
         }
     }
     return \Zend_Registry::get(Constants::CZE_LOG);
 }
Exemplo n.º 27
0
 public function testFactory()
 {
     $cfg = array('log' => array('memory' => array('writerName' => "Mock", 'filterName' => "Message", 'filterParams' => array('regexp' => "/42/"))));
     $logger = Zend_Log::factory($cfg['log']);
     $this->assertTrue($logger instanceof Zend_Log);
 }
Exemplo n.º 28
0
 public function getLog()
 {
     if (null === $this->_log) {
         $options = $this->getOptions();
         if (is_array($options)) {
             //add the db adapter where needed
             foreach ($options as $key => $option) {
                 //first see if db writer
                 if (isset($option['writerName']) && strtolower($option['writerName']) == "db") {
                     if (isset($option['writerName'], $option['writerParams']['adapter'], $option['writerParams']['params'])) {
                         $options[$key]['writerParams']['db'] = Zend_Db::factory($option['writerParams']['adapter'], $option['writerParams']['params']);
                         unset($options[$key]['writerParams']['adapter'], $options[$key]['writerParams']['params']);
                     }
                 }
             }
         }
         $log = Zend_Log::factory($options);
         $this->setLog($log);
     }
     return $this->_log;
 }
Exemplo n.º 29
0
 /**
  * Test sends message to routed queue
  *
  * @return void
  */
 public function testPublishesMessageToRoutedQueue()
 {
     $message = $this->getModelMock('messenger/message_interface', null, true);
     $router = $this->getModelMock('messenger/transport_rabbitmq_router', array('findMessageQueue'));
     $router->expects($this->any())->method('findMessageQueue')->with($this->equalTo($message))->will($this->returnValue('queue_name'));
     $channel = $this->_getChannelMock();
     $channel->expects($this->once())->method('queue_declare')->with($this->equalTo('queue_name'));
     $channel->expects($this->once())->method('basic_publish')->with($this->isInstanceOf('PhpAmqpLib\\Message\\AMQPMessage'), $this->anything(), $this->equalTo('queue_name'));
     $rabbit = $this->getModelMock('messenger/transport_rabbitmq', array('_getChannel', '_close'));
     $rabbit->expects($this->any())->method('_getChannel')->will($this->returnValue($channel));
     $rabbit->setPublishRouter($router)->setLogger(Zend_Log::factory(array(new Zend_Log_Writer_Null())))->send($message);
 }
Exemplo n.º 30
0
 /**
  * Initialize the logger at the location provided
  * in the configuration (app.ini)
  *
  * @return void
  */
 protected function _initLog()
 {
     $config = Zend_Registry::getInstance()->config;
     $logger = Zend_Log::factory($config->resources->log);
     Zend_Registry::getInstance()->set('logger', $logger);
 }