Esempio n. 1
0
 public static function instance()
 {
     if (is_null(self::$self)) {
         self::$self = new self();
     }
     SeasLog::setLogger(__CLASS__);
     return self::$self;
 }
Esempio n. 2
0
 public static function analyzerRun($configKey = NULL, $config = array())
 {
     if (empty($configKey) || !is_array($config) || count($config) < 1) {
         throw new \Exception('$configKey can`t be empty || $config must be an array.');
     }
     \SeasLog::setLogger($config['module']);
     $logLevel = intval($config['level']);
     if (empty($logLevel)) {
         $logLevel = SEASLOG_ERROR;
     }
     $_analyzer_count = \SeasLog::analyzerCount($logLevel);
     $_count_bar = array_key_exists('bar', $config) ? intval($config['bar']) : 1;
     if ($_analyzer_count > 0 && $_analyzer_count >= $_count_bar) {
         $to = array_key_exists('mail_to', $config) ? explode(',', $config['mail_to']) : array();
         $cc = array_key_exists('mail_cc', $config) ? explode(',', $config['mail_cc']) : array();
         $bcc = array_key_exists('mail_bcc', $config) ? explode(',', $config['mail_bcc']) : array();
         $subject = ' report - ' . $configKey . ' - ' . date('Y-m-d H:i:s', time());
         $_title = $config['module'] . ' 检测到 ' . $_analyzer_count . "个问题\n\n";
         $_detail = \SeasLog::analyzerDetail($logLevel);
         $_detail = '以下是此次检测详情<br /><br />' . implode("<br />", $_detail);
         $content = mailTpl::processMail($_title, $_detail, 'processed time ' . date('Y-m-d H:i:s', time()));
         alarmer::instanse()->SendEmail($subject, $content, $to, $cc, $bcc);
     }
 }
Esempio n. 3
0
 private function testLogger()
 {
     SeasLog::setLogger('aaa');
     SeasLog::setLogger('bbb');
 }
Esempio n. 4
0
<?php

/**
 * @author neeke@php.net
 */
ini_set('seaslog.disting_type', 1);
$countResult = SeasLog::analyzerCount();
ini_set('seaslog.disting_type', 1);
SeasLog::setBasePath(realpath('.'));
SeasLog::setLogger('log');
SeasLog::info('log info test');
print_r($countResult);
Esempio n. 5
0
<?php

/**
 * @Author: leandre
 * @Date:   2015-10-15 11:08:43
 * @Last Modified by:   leandre
 * @Last Modified time: 2015-10-15 11:15:24
 */
SeasLog::setBasePath('./logs/');
SeasLog::setLogger('test');
SeasLog::info('this is a info log');
SeasLog::notice('this is a notice log');
SeasLog::flushBuffer();
sleep(60);
SeasLog::error('a error log');
SeasLog::critical('some thing was critical');
Esempio n. 6
0
<?php

/**
 * @author ciogao@gmail.com
 * Date: 14-1-27 下午4:41
 */
SeasLog::getBasePath();
SeasLog::setBasePath('/log/test/base/path');
SeasLog::setLogger('test/logger');
SeasLog::log(SEASLOG_ERROR, 'this is a error test by ::log');
SeasLog::debug('this is a {userName} debug', array('{userName}' => 'neeke'));
SeasLog::info('this is a info log');
SeasLog::notice('this is a notice log');
SeasLog::warning('your {website} was down,please {action} it ASAP!', array('{website}' => 'github.com', '{action}' => 'rboot'));
SeasLog::error('a error log');
SeasLog::critical('some thing was critical');
SeasLog::alert('yes this is a {messageName}', array('{messageName}' => 'alertMSG'));
SeasLog::emergency('Just now, the house next door was completely burnt out! {note}', array('{note}' => 'it`s a joke'));
var_dump(SeasLog::analyzerCount());
var_dump(SeasLog::analyzerDetail(SEASLOG_INFO, date('Ymd', time())));
var_dump(SeasLog::analyzerDetail(SEASLOG_DEBUG, date('Ymd', time()), 'neeke', 1, 40));
var_dump(SeasLog::getLastLogger());
$buffer = SeasLog::getBuffer();
var_dump($buffer);
Esempio n. 7
0
 public function setLogger($module)
 {
     \SeasLog::setLogger($module);
 }