/** * log * * @static * @access public * @return void */ public function L($message, $level) { $options = array('log_id' => self::LOG_DEFAULT_ID); $options = array_merge($options, self::get_logsvr_config()); $writer = parent::writer_factory('logsvr', $options); parent::add_writer($writer); parent::log($message, $level); }
/** * 初始化 * * @return void */ protected function _init() { $this->log('Start swdata.', LOG_DEBUG); $array_config = array('proc_num', 'listen_host', 'listen_port', 'timeout', 'max_body', 'max_header'); foreach ($array_config as $config_name) { if (!empty($this->__proc_config[$config_name])) { $var_name = '__' . $config_name; $this->{$var_name} = $this->__proc_config[$config_name]; } } $this->__event_base = new \EventBase(); // 初始化日志对象 $options = \lib\log\sw_log::get_logsvr_config(); $options['log_id'] = \lib\log\sw_log::LOG_SWDATA_ACCESS_ID; $writer = \swan\log\sw_log::writer_factory('logsvr', $options); $this->__log_access = new \swan\log\sw_log(); $this->__log_access->add_writer($writer); $options['log_id'] = \lib\log\sw_log::LOG_SWDATA_ERROR_ID; $writer = \swan\log\sw_log::writer_factory('logsvr', $options); $this->__log_error = new \swan\log\sw_log(); $this->__log_error->add_writer($writer); }