-
Notifications
You must be signed in to change notification settings - Fork 20
Wish list Annoyances Ideas
Please provide your feedback below to make FirePHP 1.0 meet your needs and the needs of your peers. Include your name if you want to stay involved in advocating your contribution through development to release.
CAUTION: all the proposals below are based on what I found missing for me be really easy, and how I answered to my own questions; I know it may be only a partial view of a more general need for anybody, and that I may be wrong when I imagine what is the "right" solution.
Also I didn't really deep explored the alternative fb() and FB:: ways to use FirePHP: some of my wishes may have been already exhauced there. If so, sorry for the useless observations.
For my development-tools as well as for my developments themselves, I like to be as comfortable and "free" as possible: means that, for anything repetitive, I try to organize things so I can then forget it. It is why I talk about the following point.
First, when enabled, FirePHP needs ob_start() be called to work. In the other hand, as doc says, "WARNING: Using FirePHP on production sites can expose sensitive information". Sure I agree! And you already made things simple with setEnabled() method, so we don't need to inhibit log calls on production sites. But it may be yet simpler, assuming the most common place to test is local.
So I wrote a quite simple part of code, installed once for all in my standard initialization part, like this:
<?php
require_once('where_it_resides/FirePHP.class.php');
$FP=FirePHP::getInstance(true);
if(
$_SERVER['SERVER_NAME']=='127.0.0.1'
or
$_SERVER['SERVER_NAME']=='localhost'
) {
ob_start();
}
else {
$FP->setEnabled(false);
}
?>
Thus no mind changing even a few lines between test and production versions. And if the need occurs, however, it remains possible to live enable it on a production site.
A possibility of enhancement should be to include this "if/else" sequence in getInstance() method, adding a precaution to be more general:
In the discussion started in issue 103, I proposed a DB-oriented enhancement to make table() method to accept Table arg where rows are associative arrays, with field names as keys, and display these field names as a header. Then it appeared that [email protected] had already proposed a slightly different enhancement, making table() method to accept both associative and indexed rows, even mixed in the same table, but so obviously without the ability of displaying a header. (but I further discovered that its solution doesn't work as is, because it only adds numeric-key items and does not eliminate the associative ones)
I think it would be interesting to make this method as versatile as possible, integrating these two features through an heuristic way. Seamed to me pretty simple, and I planned to write and test my solution to include it here. But currently I remain stuck with something which runs wrong, so for now I let this comment bare.
BTW, a minor point: strangely, table() method arguments appear in the inverse order than in other methods, which may often lead to write wrong code. Could be solved by a simple heuristic way:
<?php
public function table($Label, $Table) {
if(is_array($Label)) { # must exchange args
$temp=$Label;
$Label=$Table;
$Table=$temp;
}
return $this->fb($Table, $Label, FirePHP::TABLE);
}
?>
In firebug, there is 2 methode, time() and timeEnd().
I'd like to have similary functions in firephp, and even one more function make intermediate time
could be something like
- time(label = 'timer') : Start a timer with name (default name is timer) and log start message
- timeLap(label='timer') : Display elapsed time since last start/timeLap call and elapsed time since timer start for the timer name
- timeEnd(label='timer') : End timer named and display elapsed time since last timeLap if any and elapsed time since timer start.
Eg: $fp->time(); $fp->time('tip'); foreach($tab as $item) { DoSomething($item); $fp->timeLap('tip'); } finishWork(); $fp->timeEnd(); $fp->timeEnd('tip');
will display in firebug console
chrono timer started
chrono tip started
tip: 15ms / 15ms
tip: 14ms / 29ms
tip: 15ms / 44ms
chrono:50ms
tip: 6ms / 50ms
Console messages for timer could be colored like green for start event, blue for lap and red for stop.
- Rename Debug to more specific name or emulate package like ZF eg. Firephp_Debug
- nlloyds: 2009-05-18: Have an option to not have the variable view appear when hovering over an object. Often I would prefer to inspect in the DOM tab and not use the variable viewer at all. 0.3 looks much faster but I've had the variable viewer crash Firefox lots of times when I dump huge objects.
Actually, firebug have a on/off trigger that allow to let trace in code permanently. I wish to be able to active trace on selected class/method/function.
Like in demo http://www.firephp.org/Examples/PHPArchitect/ where some options (execution time, included files, etc) can be activated, i would like to be able to give Debug::enable a filter for traces.
Filter could be a regexp to applied on magical constant METHOD, this will allow to select any classes, methods or functions.
Like in architect demo, a cookie could hold the information of filter. For UI, either a dedicated method in firephp Debug class to display all filters possibility, or a UI in the Firefox extension if possible
With includeLineNumbers set to true, we get file/line where log happened. But often this happens deep in a nested function, which may have been called from many different points, so in this case the information is useless. Then to be more informed we must use the trace() method in addition, which turns heavy since:
- it needs 2 consecutive FirePHP calls to be written for each individual log
- information is displayed as 2 different and separated "logical lines", occuping yet more "physical lines"
- we loose the friendly instant display of includeLineNumbers
So I think it will be kind to have includeLineNumbers to display the entire path (the same information as given by trace() method, but on a unique compacted line). It might appear in a classical site-path manner, but reversed (right-to-left), to ensure deepest part to be always visible, like:
"ClassX->aMethod(#x) << ClassY->otherMethod(#y) << aFunc(#z) << main(#n)"
Sure there is a problem with how to display the complete line when it is too long to fit in the window. At the moment, I don't figure out. May be possible to use the same as Variable Viewer, though it is not from the same Console place? I don't know.