PHP日志扩展:SeasLog

分享到:
SeasLog目前提供了什么

  • 在PHP项目中便捷、规范地记录log

  • 可配置的默认log目录与模块

  • 指定log目录与获取当前配置

SeasLog的目标

  • 便捷、规范的log记录

  • 高效的海量log分析

  • 可配置、多途径的log预警

SeasLog编译安装

cd SeasLog/

phpize

./configure --with-php-config=php-config

make
make install

seaslog.ini

; configuration for php SeasLog module
extension=seaslog.so
seaslog.default_basepath = /log/seaslog-test
seaslog.default_logger = default

Demo:

<?php
/**
 * @author ciogao@gmail.com
 * Date: 14-1-27 下午4:41
 */

echo '<pre>';
var_dump(SEASLOG_TYPE_INFO);
var_dump(SEASLOG_TYPE_WARN);
var_dump(SEASLOG_TYPE_ERRO);
var_dump(seaslog_get_basepath());
var_dump(seaslog_get_lastlogger());
var_dump(seaslog_get_basepath());
var_dump(seaslog('test info'));
var_dump(seaslog('test warning', SEASLOG_TYPE_WARN));
var_dump(seaslog('test error', SEASLOG_TYPE_ERRO));
var_dump(seaslog_set_basepath('/log/base_test'));
var_dump(seaslog_set_logger('testModule/app1'));
var_dump(seaslog('test info 2'));
var_dump(seaslog('test warning 2', SEASLOG_TYPE_WARN));
var_dump(seaslog('test error 2', SEASLOG_TYPE_ERRO));
var_dump(seaslog_get_basepath());
var_dump(seaslog_get_lastlogger());
var_dump(seaslog_get_basepath());
var_dump(seaslog('test error 3', SEASLOG_TYPE_ERRO, 'test/bb'));

echo "\n"; 

项目主页:http://www.open-open.com/lib/view/home/1391827042473

昵    称:
验证码:

相关文档: