Giter Site home page Giter Site logo

nette / tracy Goto Github PK

View Code? Open in Web Editor NEW
1.7K 73.0 216.0 4.66 MB

๐Ÿ˜Ž Tracy: the addictive tool to ease debugging PHP code for cool developers. Friendly design, logging, profiler, advanced features like debugging AJAX calls or CLI support. You will love it.

Home Page: https://tracy.nette.org

License: Other

PHP 78.96% CSS 5.19% JavaScript 7.91% HTML 7.15% Shell 0.70% Batchfile 0.09%
nette nette-framework tracy dump-variables php debugger profiler ajax php-errors error-handling

tracy's Issues

svg element in document and click event

// tests whether element has given class
Query.prototype.hasClass = function(className) {
    return this[0] && this[0].className && this[0].className.replace(/^|\s+|$/g, ' ').indexOf(' '+className+' ') > -1;
};

if i click on svg element on page where is trace debugger enabled, so this bug appear

TypeError: this[0].className.replace is not a function

...eturn this[0] && this[0].className && this[0].className.replace(/^|\s+|$/g, ' ')...

Feature: Dump to file

In both the development and the production there is a lot of situations where "super-smart" solutions like Firelog cannot be used. Sometimes it is impossible even to get the script output to the browser, eg. non-HTTP applications like cron jobs etc.

It would be nice to have the ability to dump variables to a file in the %tempDir%.

API would be as follows:

class Debugger { function fileDump($variable, $name = NULL); }

This will produce Tracy's nice clickable dump saved in the %tempDir% in a HTML file optionaly with a custom name. I assume that some smart variable hash, PID and/or time prefixes could come into play.

@dg does this a chance to be merged? Should I prepare a pull?

Is there a way to change the red background of the firelogger messages

When I run tracy-2.2.6/examples/firebug-dump.php or tracy-2.3.0/examples/firebug-dump.php, the three messages in the firebug logger tab have a bright red background that isn't easy to read - for me.
Also tracy doesn't seem to take advantage of firelogger's info, warning, error, ... levels.

I just can't see where this red color is coming from.

sc-20150303-165615

dump() shortcut to return dump instead of print

I think it would be nice if dump() shortcut would behave just like \Tracy\Debugger::dump, I mean that the second argument set to TRUE will make dump to return the dumped value as string instead of printing out.
However, as it would be a BC break because dump() now returns its first argument, I'm not sure if it wouldn't be a better idea to solve it another way, for example make another shortcut sdump()...
I need this quite often (dumping something to logs, in console where echo does not work etc...) and I would find such shortcut extremely useful.
And, I would willingly create a pull request if you agree here about the form of the shortcut :)

unexpected ...

Tracy\Helpers.php, line 54

public static function formatHtml($mask, ...$args)

fix to:

public static function formatHtml($mask, $args)

Debug mode detection - accept CIDR notation

It would be nice to accept CIDR notation for allowed (aka developer) addresses.
E.g. for a team working on a project in same office, it would be good to set allowed addresses to 10.0.0.0/8 or fc00::/7, so they can see each others' instances in debug mode. Or for a shared in-office testing machine.
Also relates to nette/bootstrap#9.

Tracy 2.2.3 say it is 2.2.2

In Tracy 2.2.3 is still version 2.2.2, so on bluescreen is wrong information about version of Tracy

In Tracy\Debugger.php should be in public static $version = '2.2.3'

Optinally log bluescreens for warnings and notices

There should be a switch Debugger::$logErrorBlueScreens = FALSE; that when set to TRUE would force Tracy to log entire stack of ErrorException (render the bluescreen) and not only it's message in production mode.

I would have sent a pullrequest already but I don't know how to name that property :) Any ideas @dg?

(@Vrtak-CZ needed it too. So Patrik, if you're going to implement this, write it in this issue so we're not doing it both at the same time, I will also write it here when I find the time for it)

Doubled backslash when dumping \x

dump('\\x'); // produce \\x instead of \x

More obvious with

dump('D:\\data\\path\\xml\\file.xml'); // D:\data\path\\xml\file.xml

It is happening in Dumper::encodeString(). I'm not sure how to fix it (remove $utf['\\x'] = part?)

Bad performance

I have low memory on my virtual machine and it takes forever to load error page. Some times I even get out of memory error. I am guessing is problem in stack trace. Can I limit stack trace?

Dump full exceptions with FireLogger

With FireBug active, we can see nice bugs in firefox console (or even in chrome with appropriate extensions), however we've lost the nice tracy's red screen of death. As I looked into tracy code, the exception file is not created if FireBug is available and there is no option to tell tracy we want it (I think it isn't necessary to explain high value of information about error in compare with simple firebug line).
I think there should be possibility to tell Tracy to create exception file even if there is FireBug enabled, isn't it?
I can implement and pullrequest it with no problem, just please comment if you think it is good/bad idea or how to solve it better.

Maximum call stack size exceeded

Commit 97fdab4 broke dumping recursive structures. The following code will result in infinite recursion.

$obj = new stdClass();
$obj->a = $obj;
echo Dumper::toHtml($obj, [Dumper::LIVE => TRUE]);

DebugBar insertion brakes when using BrowserSync as proxy

Steps to reproduce:

  1. Install browser-sync npm install -g browser-sync
  2. Run browser-sync as proxy browser-sync start --proxy "localhost"
  3. Navigate to nette app with enabled debug bar

Result:

JS error in console: Uncaught SyntaxError: Unexpected token ILLEGAL

image

Dumped object hash duplicate

Tracy uses spl_object_hash() for dumped object hashes (e.g. stdClass #de00). But this function ensure unique hash for existing objects only. It "reuses" hashes of no longer exist objects. See example.

I hit this issue during dumping in loop in console. All dumped objects had the same hash even different content.

Parse errors not shown?

I can't seem to get Tracy to handle Syntax/Parse errors on my server, is there something I am missing?

I am using the code below, it catches Exceptions, but not Syntax errors for some reason.

use Tracy\Debugger;
Debugger::enable(Debugger::DEVELOPMENT, dirname(__DIR__).'/logs');
Debugger::$strictMode = TRUE;

Enable custom error template

Hello,

we are using tracy but we need set custom error template instead of default error.phtml. I prepared 2 pull requests to enable this feature. One in Tracy and one in bootstrap to add possibility to change error template via NetteExtension.

Overriding file path

Would be great to have file path configurable. E.G. substitution by regex or something more user friendly. Currently my team works using sshfs on a shared remote development server, this causes tracy to detect environment as production (which is not a problem as you may override with \Tracy\Debugger::enable(\Tracy\Debugger::DEVELOPMENT);.

The links to the files is a problem though, the editor://open/?file=/some/path/to/webroot/project/file is not configurable and leads to the server based file path.

What would be nice is to either have a base project directory configuration variable and to have all paths be relative to that, either have a path overriding callback.

This is not only useful for those of us who work with sshfs but every other remote development like mapped ftp etc.

Display line when dumping variables

When using Debugger::dump($var), the variable name should be displayed with the variable content.

Mockup :
image

Being able to enable/disable :

Debugger::$showVarName = true; // default: false

EDIT :
Just discovered the $showLocation setting, you should add it in the doc on github with the depth example.

For those who don't know :
to display the file and line where the dump is, use

Debugger::$showLocation = true;

Possibility to split exceptions and logs (and split log files by days) into separated directories

Hello,

we are using Tracy in a big project with a high traffic. It can generate many exceptions and warnings. For clarity, we are saving exceptions and logs into separated directories. And logs we are spliting by days (for example: error-2014-01-01.log, info-2014-01-01.log). It would be great, if this functionality can be in Tracy (optional). If there will be interest in this functionality, I will write the pull-request.

New Bar icons

Are you open to change the bar icons? I would suggest to use Fontawesome font to generate bigger icons to look good on retina.

My suggestions:

Execution time: http://fontawesome.io/icon/clock-o/
Memory: http://fontawesome.io/icon/bar-chart/
Routes: http://fontawesome.io/icon/road/
Database: http://fontawesome.io/icon/database/
Identity: http://fontawesome.io/icon/user/

I suppose, 32x32px should be enough for retina displays.

License allows use icons without attribution, but i would suggest to mention it somewhere.

Broken Tracy bar when used with BrowserSync

When using Tracy together with BrowserSync, Tracy bar produces invalid HTML code at the end of file like this:

<!-- Tracy Debug Bar -->
<script>
(function(onloadOrig) {
    window.onload = function() {
        if (typeof onloadOrig === 'function') onloadOrig();
        var debug = document.body.appendChild(document.createElement('div'));
        debug.id = 'tracy-debug';
        debug.innerHTML = "&nbsp;\n\n<style id=\"tracy-debug-style\"

// โ€ฆ
// Tracy's code continues.
// โ€ฆ

doc = win.document;\n\t\tdoc.write('<!DOCTYPE html><meta charset=\"utf-8\"><style>' + $('#tracy-debug-style').dom().innerHTML + '<\\\/style><script>' + $('#tracy-debug-script').dom().innerHTML + '<\\\/script><body id=\"tracy-debug\">
<script type='text/javascript'>//<![CDATA[
;document.write("<script defer src='//HOST:3000/socket.io/socket.io.js'><\/script><script defer src='//HOST:3001/client/browser-sync-client.0.9.1.js'><\/script>".replace(/HOST/g, location.hostname));
//]]></script>
');\n\t\tdoc.body.innerHTML = '<div class="\&quot;tracy-panel" tracy-mode-window\"=""

// Unescaped HTML continues.
// โ€ฆ

BrowserSync also injects JS a HTML into DOM which seems to be the cause of conflict. You may notice socket.io script injected by BrowserSync close to the end. However, since BrowserSync itself works fine with Tracy and does not seem to be affected by this error, it looks like it is Tracy's issue. If not, please let me know to report the issue at BrowserSync.

How to customise Error Page ?

Hi,
I seems tracy has all cool features as I am looking for, but i would like to know how can I customise error template page, I am trying to integrate with my latest project Cygnite Framework , I would like to display few information about Cygnite Framework in the Error page.

Is it possible i can overwrite the error page, change design, color schema, project name and version etc.

Any response would be highly appreciated.

Thanks,
Sanjoy

Usage of ext-iconv

An unnecessary throws an error when ext-iconv not available.

Fatal error: Uncaught Error: Call to undefined function Tracy\iconv_strlen() in //vendor/tracy/tracy/src/Tracy/assets/Bar/info.panel.phtml:48
Stack trace:
#0 //vendor/tracy/tracy/src/Tracy/DefaultBarPanel.php(50): require()
#1 //vendor/tracy/tracy/src/Tracy/Bar.php(73): Tracy\DefaultBarPanel->getPanel()
#2 //vendor/tracy/tracy/src/Tracy/Debugger.php(207): Tracy\Bar->render()
#3 [internal function]: Tracy\Debugger::shutdownHandler()
#4 {main}
  thrown in //tracy/tracy/src/Tracy/assets/Bar/info.panel.phtml on line 48

Add support for Bar and BlueScreen Debugger dependency injection

I wonder why there is no way to set Tracy\Bar and Tracy\BlueScreen into Tracy\Debugger via setter dependency injection. It will be nice to have such a possibility. Now it is barely possible with class_alias() or maybe different workaround.

Just want to know your opinion, for now.

Debugger::$showLocation flag has no effect

Yesterday, after I downloaded the new Nette 2.3.0, I have discovered this:

Enabling the $showLocation flag in the Debugger class has no effect when displaying the dump (printed on the page, not in the debug bar). That is: The expected tooltip pointing out the location (file & line number) of the dump() function doesn't show up.

I have managed to pinpoint the candidate causing the problem and it seems to be the break; statement used in the Dumper::findLocation() method: https://github.com/nette/tracy/blob/master/src/Tracy/Dumper.php#L516

If I remove the break; statement, it seems to work - the tooltip is displayed.

The general lack of documentation of/in the code and the fact that the break; statement looks like a part of something bigger keeps me from doing this myself and creating the PR. Therefore I humbly ask anyone, who knows what exactly it does, to fix this.

Duplicated tracy bar

I'm having the bar Debug duplicate tracy as printscreen'm with version 2.2.3 of nette

image

PHP7 on Win32: Fatal error: Cannot use "self" when no class scope is active

Hi! Just trying the nigtbuild of php-master (php7) with clean nette/web-project, running on internal php webserver: "php -S 0.0.0.0:88" ends up with Fatal error in Tracy.

Fatal error: Cannot use "self" when no class scope is active in C:\Users\George\Documents\Web\web-project\vendor\tracy\tracy\src\Tracy\assets\BlueScreen\bluescreen.phtml on line 101.

Debugger::enable() can be called only once (latest Nette 2.2.2)

Hi.

When Debugger::enable() is called more than once in code, Tracy bar doesn't respond to mouseover for details.

It's easy to demonstrate this issue also in sandbox.
For example, in sandbox's bootstrap.php,

after $configurator->enableDebugger(__DIR__ . '/../log');
put Debugger::enable();,

and now, try mouseover in Tracy bar - it doesn't work.

So, you cannot call Debugger::enable() wherever and whenever :)

Debugger::enable() has been re-implemented in Nette 2.2.2 with this issue.

Production Mode Error Page Customization

Is there a simple way to customize the error page output? Preferably in a modular fashion so that I don't have to replace the template or something like that?

Contenct-Security-Policy

I'm currently experimenting with Content-Security-Policy and sure enough Tracy doesn't work unless both 'unsafe-inline' and 'unsafe-eval' are allowed. I can enable them for development only of course but I'd like to avoid it. Enabling It could easily lead me to a situation where I miss some real CSP violation because of it and push it to production.

isHtmlMode() not very Robust

I'm more than happy to make the changes to this and submit a pull request, but I wanted to open an issue for discussion.

Currently isHtmlMode() does a preg match against the headers list for a content type not equal to text/html. This probably works well when the content type header is established, however, failed for CLI based applications and non-HTTP based SAPIs. By relying on an HTTP header, it assumes HTTP is how the client is interfacing with the application.

This in particular causes the bar to get output in my CLI applications.

A few ideas which might make sense.

  • Add a check to see if $_SERVER['SERVER_PROTOCOL'] is HTTP/XX where XX version doesn't matter. If that is HTTP, then check as it does now.
  • Add explicit checks for php_sapi_name() -- this might not be completely ideal as the SAPI does not necessarily indicate the output format.
  • Add explicit method to set "output" format, "html" vs. "plain" vs. potential others down the line (JSON?)

The last is the most flexible, although it should probably be combined with at least a sane default based on the first or second.

Move Tracy under namespace Nette\Tracy

I don't think Tracy should be ashamed of to be part of Nette Framework (or being developed by Nette Foundation). If you will create more repositories with parts of Nette (e.q. Nette\Image) in future, it will be impossible to find cool names for all of them.

In fact, I don't think it is necessary to rename Nette\Diagnostics at all :)

Feature: Custom loggers

It would be nice to be able to attach any custom logger to the Tracy's logging mechanism. Tracy would log everything as it is now, but additionally it would "dispatch" an "error event" and pass the error to the attached loggers. IMHO the accepted Logger Interface could be used.

JavaScript error on toggling

This is not serious problem, everything works, only console is filled by errors.

For reproduction, enable debugger and dump array.

Tracy\Debugger::enable();
dump(array(1));

open a browser console and toggle the dumped array.

In FF: TypeError: newPosition is undefined
In Chrome: Uncaught TypeError: Cannot read property 'right' of undefined

It is due to panel.position() in dumper.js returns undefined. I'm not sure how to fix it, it seems to me, that there is mixed-up toggling of Bar panels and dumped variables.

Update to 2.3.7 whitescreens instead of showing exception page (PHP 7 RC6)

After the update to 2.3.7 it doesn't show the exception page anymore, it just whitescreens with a 500 http status code.
It works when I roll back to 2.3.6.
And I'm running on PHP 7 RC6.

Not using the debug bar, but using the Debugger::exceptionHandler($e); to handle the exceptions globally.

I'm not really sure what is causing it, but if you have any questions just ask and I'll do my best to help :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.