Example #1
0
 public static function configureLogger($inifile)
 {
     $fromini = parse_ini_file($inifile);
     if (!is_array($fromini) || !(count($fromini) > 0)) {
         echo "Logger : inifile " . $inifile . " not found\n";
         exit;
     } else {
         self::$ini = array_merge(self::$ini, $fromini);
         self::$level = self::toInt(self::$ini['defaultlevel']);
         self::$logpath = self::$ini['logpath'];
         self::$destination = self::$ini['output'];
         self::$includeTime = self::$ini['includeTime'];
         self::$includeLevel = self::$ini['includeLevel'];
         self::$includeMemory = self::$ini['includeMemory'];
         self::$overwriteLogs = self::$ini['overwriteLogs'];
     }
 }
Example #2
0
 static function init($config = array())
 {
     if (!isset($config['level'])) {
         self::$level = 0;
     } else {
         if ($config['level'] == '*' || strcasecmp($config['level'], 'all') === 0) {
             self::$level = self::$max_level;
         } else {
             foreach (self::$level_map as $k => $v) {
                 if ($v === strtoupper($config['level'])) {
                     self::$level = $k;
                     break;
                 }
             }
         }
     }
     if (isset($config['dump'])) {
         $ps = explode('|', $config['dump']);
         if (in_array('file', $ps)) {
             self::$dump |= self::DUMP_FILE;
         }
         if (in_array('html', $ps)) {
             self::$dump |= self::DUMP_HTML;
         }
         if (self::$dump & self::DUMP_FILE) {
             if (!isset($config['files'])) {
                 $config['files'] = array();
             }
             foreach ($config['files'] as $k => $v) {
                 $k = strtoupper($k);
                 $config['files'][$k] = $v;
             }
         }
     }
     self::$config = $config;
 }
Example #3
0
 /**
  * Sets level of logging
  * 
  * @access public
  * @param int Level
  * @static 
  */
 public static function setLevel($level)
 {
     self::$level = $level;
 }
Example #4
0
 /**
  * 設定ファイルに記載しているような(debug, noticeなどの)プライオリティ指定から、
  * ログに出力するレベルの閾値を決める
  *
  * @return none
  */
 public static function setLogLevel($levelStr)
 {
     if (array_key_exists($levelStr, self::$logLevelList)) {
         self::$level = self::$logLevelList[$levelStr]['value'];
     }
 }
Example #5
0
 function __construct($base_url, $config = [])
 {
     $this->base_url = $base_url;
     $this->config = array_merge($this->config, $config);
     Logger::level($this->config['log_level']);
 }