欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

PHP日志扩展:SeasLog

程序员文章站 2022-06-13 14:06:21
...
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