当前位置:Gxlcms > PHP教程 > PHP日志扩展:SeasLog

PHP日志扩展:SeasLog

时间:2021-07-01 10:21:17 帮助过:4人阅读

SeasLog目前提供了什么

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

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

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

SeasLog的目标

  • 便捷、规范的log记录

  • 高效的海量log分析

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

SeasLog编译安装

  1. cd SeasLog/
  2. phpize
  3. ./configure --with-php-config=php-config
  4. make
  5. make install

seaslog.ini

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

Demo:

  1. /**
  2. * @author ciogao@gmail.com
  3. * Date: 14-1-27 下午4:41
  4. */
  5. echo '
    ';
  6. var_dump(SEASLOG_TYPE_INFO);
  7. var_dump(SEASLOG_TYPE_WARN);
  8. var_dump(SEASLOG_TYPE_ERRO);
  9. var_dump(seaslog_get_basepath());
  10. var_dump(seaslog_get_lastlogger());
  11. var_dump(seaslog_get_basepath());
  12. var_dump(seaslog('test info'));
  13. var_dump(seaslog('test warning', SEASLOG_TYPE_WARN));
  14. var_dump(seaslog('test error', SEASLOG_TYPE_ERRO));
  15. var_dump(seaslog_set_basepath('/log/base_test'));
  16. var_dump(seaslog_set_logger('testModule/app1'));
  17. var_dump(seaslog('test info 2'));
  18. var_dump(seaslog('test warning 2', SEASLOG_TYPE_WARN));
  19. var_dump(seaslog('test error 2', SEASLOG_TYPE_ERRO));
  20. var_dump(seaslog_get_basepath());
  21. var_dump(seaslog_get_lastlogger());
  22. var_dump(seaslog_get_basepath());
  23. var_dump(seaslog('test error 3', SEASLOG_TYPE_ERRO, 'test/bb'));
  24. echo "\n";

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

人气教程排行