首頁 >後端開發 >php教程 >PHP日誌擴充:SeasLog

PHP日誌擴充:SeasLog

WBOY
WBOY原創
2016-07-25 09:12:311506瀏覽
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



陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn