Skip to content

yuncopy/debugger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Debugger日志操作

DEBUG_LEVEL=0的时候不会在后端运行, DEBUG_LEVEL=1的时候会记录错误、警告信息以及资源调用的耗时汇总统计, DEBUG_LEVEL=2的时候,会记录全部的数据 如果在参数列表中出现 __DEBUG_LEVEL ,则会强制覆盖 DEBUG_LEVEL 的值

功能列表如下: 1 time 性能探针,计算运行的步骤以及每一步的执行效率; 2 log 日志记录,把每一个日志信息记录下来; 3 http 接口调用的记录以及耗时的汇总统计; 4 redis redis调用的记录以及耗时的汇总统计; 5 mysql mysql调用的记录以及耗时的汇总统计; 6 cache memcache调用的记录以及耗时的汇总统计;

  • 安装 composer require php-debug/debugger
  • 初始化 require(__DIR__ . '/../vendor/autoload.php');
  • 使用手册
    $mtime1 = microtime();
        数据库连接操作...
    $mtime2 = microtime();
     \Debugger\Debugger::_mysql(
        'connect',   //标签
        [],   //额外参数,数组形式
        array('host' => $this->settings['host'], 'dbname' => $this->settings['dbname']), //主要参数输出 
        $mtime1, $mtime2 // 开始时间 结束时间
     );
    
    • _log、_http、_redis、_cache同理
    • 将消息输出到指定的文件 \Debugger\Debugger::writeDebugLog($content,$file)
    • debug_backtrace \Debugger\Debugger::writeBacktrace()

About

调试日志操作组件

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages