示例#1
0
文件: log.php 项目: sevir/toffy-lite
 private static function initialize()
 {
     if (self::$initialized) {
         return;
     }
     self::disable_ob();
     try {
         self::$redis = new Redis();
         self::$redis_enabled = self::$redis->pconnect('127.0.0.1', 6379, 0.01);
     } catch (Exception $e) {
     }
     if (isset($_SERVER['HTTP_HOST'])) {
         self::$log_prefix = $_SERVER['HTTP_HOST'];
     } else {
         self::$log_prefix = basename(realpath(__DIR__ . '/../../../'));
     }
     if (file_exists(dirname(__FILE__) . '/system/logs/')) {
         self::$log_path = dirname(__FILE__) . '/system/logs/';
     } else {
         if (file_exists(dirname(__FILE__) . '/../application/logs/')) {
             self::$log_path = dirname(__FILE__) . '/../application/logs/';
         }
     }
     self::$initialized = true;
 }