Ejemplo n.º 1
0
 /**
  * __construct 
  * 
  * @access public
  * @return void
  */
 public function __construct()
 {
     $this->__log_id = \lib\log\sw_log::LOG_PHPD_ID;
     $this->__proc_name = 'phpd';
     $this->__log_options = \lib\log\sw_log::get_logsvr_config();
     $this->_init_log('phpd', true);
 }
Ejemplo n.º 2
0
<?php

require_once 'core.php';
use lib\log\sw_log;
$options = \lib\log\sw_log::get_logsvr_config();
$options = array_merge($options, array('log_id' => 2));
$writer = sw_log::writer_factory('logsvr', $options);
$message = sw_log::message_factory('phpd');
$message->message = 'swdata';
$log = new \lib\log\sw_log();
$log->add_writer($writer);
$config = array("enable" => 1, "debug" => 0, "graph_interval" => "5");
$process = new \lib\process\sw_push_server();
$process->set_log($log);
$process->set_message($message);
$process->set_proc_config($config);
$process->run();
Ejemplo n.º 3
0
 /**
  * 初始化
  *
  * @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);
 }