tommy/debug-info 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

tommy/debug-info

Composer 安装命令:

composer require tommy/debug-info

包简介

Magento module for convenient debugging and performance information

README 文档

README

Alternative way to control your web application: debug, dump variables and measure performance

If you tired use some combination like this

var_dump($some);
die();

And want some more comfortable, or you can`t use debugger, and still want to see some intermediate data when using Ajax, this for You.

Installation

  • Copy all files except docs to your magento project
  • Login (and maybe relogin) into admin panel
  • Configure this in your own way (based on your security needs or habits) Magento Admin -> System -> Configuration -> TOMMY -> Debug Info -> Custom Debug Info Settings

Usage

echo

In your code put some like this:

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

Then go to web browser and you`ll see there Image of output

In this example I use this configuration for module: "Force Include output, if get this param" set to "?showInfog" in admin section

var_dump

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

You`ll see in Chrome console your object Image of output

Time measure

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

You`ll see in browser your data If you want some intermediate data for your large process

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

Image of output

Compare cached blocks with real render

To check block caching is correct, you can use option in config part

Work modes

  • Frontend
  • Special url postfix
  • Session

Frontend

It works like described in screen outputs above. You see data in the bottom of browser page. This mode not recomended for production environment.

Special url postfix

Like "Frontend" but use additional get parameter. Without this parameter we`ll get default behavior for pages.

Session

In browser special page: http://url your.web.site/debug_info you`ll see list of connection (requests) to site. Browse to link you need then see all data like in "Frontend" mode. This mode require magento cache, there placed all data, you can clear magento cache this lead to clear debugInfo`s data Image of output Result is

Requirements

  • Magento (tested only in 1.9)
  • jQuery (and set path to it in cofiguration, tested in 1.10*)
  • Browser (tested in Chrome and Mozilla)
  • PHP (tested in 5.5, must work in 5.3)

Recomend

I like use the module with Cache Viewer , also I offer use development environment in 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; and in index.php type this

//.....
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);
}
//.....

统计信息

  • 总下载量: 4
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-04-13