tommy/debug-info

此软件包已被废弃且不再维护。未建议替代软件包。

用于方便调试和性能信息的Magento模块

安装: 4

依赖项: 0

建议者: 0

安全: 0

星级: 2

关注者: 2

分支: 0

开放问题: 0

类型:magento-module

dev-master 2015-04-29 15:30 UTC

This package is not auto-updated.

Last update: 2023-09-30 11:37:53 UTC


README

控制您的Web应用的另一种方式:调试、输出变量和测量性能

如果您已经使用了一些组合

var_dump($some);
die();

希望有更舒适的方式,或者您不能使用调试器,但在使用Ajax时仍然想看到一些中间数据,这个工具适合您。

安装

  • 将所有文件(除docs外)复制到您的magento项目
  • 登录(可能需要重新登录)到管理面板
  • 根据您的安全需求或习惯进行配置:Magento管理 -> 系统 -> 配置 -> TOMMY -> 调试信息 -> 自定义调试信息设置

使用方法

echo

在您的代码中添加一些类似的内容

Tommy_DebugInfo_Helper_Data::getMe()->addDebugOutput('Message section', 'My debug mess :)');

然后转到网页浏览器,您将看到输出图像

在此示例中,我在管理部分将该模块的此配置设置为“如果获取此参数,则强制包含输出”,设置为“?showInfog”

var_dump

$performance = Tommy_DebugInfo_Helper_Data::getMe();
$someArrayOrObject = new stdClass();
$someArrayOrObject->name='Home';
$someArrayOrObject->status=1;
$performance->addDirectOutput($someArrayOrObject, 'someArrayOrObject');

您将在Chrome控制台中看到对象输出图像

时间测量

$performance->addPerformanceLog('sleep 5 sec');
sleep(5);
$performance->addPerformanceLog('sleep 5 sec', 'finish');

如果您想为大型进程获取一些中间数据,您将在浏览器中看到您的数据

$performance->addPerformanceLog('sleep 5 sec');
sleep(3);
$performance->addPerformanceLog('sleep 5 sec', 'breakpoint');
sleep(2);
$performance->addPerformanceLog('sleep 5 sec', 'finish');

Image of output

比较缓存块与实际渲染

要检查块缓存是否正确,您可以在配置部分使用选项

工作模式

  • 前端
  • 特殊URL后缀
  • 会话

前端

此模式的工作方式与屏幕输出中描述的相同。您将在浏览器页面底部看到数据。此模式不建议用于生产环境。

特殊URL后缀

与“前端”类似,但使用额外的GET参数。如果没有此参数,我们将为页面获取默认行为。

会话

在浏览器中的特殊页面:http://url your.web.site/debug_info,您将看到连接(请求)到网站的列表。浏览到所需的链接,然后您将看到与“前端”模式中相同的数据。此模式需要magento缓存,其中放置了所有数据,您可以通过清除magento缓存来清除debugInfo的数据输出图像 结果为

需求

  • Magento(仅在1.9中测试过)
  • jQuery(并在配置中设置路径,已在1.10*中测试过)
  • 浏览器(已在Chrome和Mozilla中测试过)
  • PHP(已在5.5中测试过,必须在5.3中工作)

推荐

我喜欢使用此模块与Cache Viewer一起使用,我还提供使用开发环境在Magento中使用的建议

server {
# .....
    server_name site.test www.site.test;
    root /var/www/site;
    location / {
        try_files $uri /index.php$is_args$args;
    }
# .....
    location ~ \.php$ {
       include fastcgi_common;
       fastcgi_param  MAGE_IS_DEVELOPER_MODE 1; # enable dev mode
    }
}

- nginx,

<VirtualHost *:80>
#
	ServerName site.test
	ServerAlias www.site.test
	SetEnv MAGE_IS_DEVELOPER_MODE 1  # enable dev mode
#.......

- apache2;并在index.php中输入以下内容

//.....
require_once $mageFilename;
if (isset($_SERVER['MAGE_IS_DEVELOPER_MODE'])) {
    Mage::setIsDeveloperMode(true);
    Varien_Profiler::enable(); // from profiler debugInfo get data
    ini_set('display_errors', 1);
}
//.....