php-debug/debugger

The debugger for the wzphp framework

Installs: 2 477

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Type:php-extension

v0.1.0 2019-02-20 08:23 UTC

This package is auto-updated.

Last update: 2024-06-20 20:52:41 UTC


README

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()