public static function setLogPath() { if (!class_exists('Seaslog')) { throw new \Exception('SeasLog没有开启,请开启服务!'); } //设置seasLog保存位置 \SeasLog::setBasePath('./Runtime/SeasLog'); }
/** * 设置路径 * @throws \Exception */ public static function setLogPath() { if (!class_exists('Seaslog')) { throw new \Exception('SeasLog没有开启,请开启服务!'); } //设置seasLog保存位置 \SeasLog::setBasePath(C('SEASLOG_SAVEA_PATH')); }
/** * @author neeke@php.net * Date: 16/1/11 上午10:15 */ function testAction() { $path = "/usr/local/nginx/html/logs"; \SeasLog::setBasePath($path); \SeasLog::setBasePath($path); \SeasLog::notice("a"); return; }
public static function run() { config::getConfig(); \SeasLog::setBasePath(config::getAnalyzerPath()); if ($forkCount = config::getForkCount()) { coreRun\pcntl::setForkCount($forkCount); coreRun\pcntl::run(); } else { coreRun\single::run(); } }
private function testBasePath() { SeasLog::setBasePath('aaa'); SeasLog::setBasePath('bbb'); }
<?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);
<?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');
<?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);
<?php /** * @author ciogao@gmail.com * Date: 14-3-8 下午4:30 */ function seaslog_autoloader($class) { if (!class_exists($class)) { $filename = BASE_PATH . '/' . str_replace('\\', '/', $class) . '.php'; include_once "{$filename}"; } } spl_autoload_register('seaslog_autoloader'); \SeasLog::setBasePath(BASE_PATH . '/result');