FirePHP4Chrome icon indicating copy to clipboard operation
FirePHP4Chrome copied to clipboard

Feature Request: support formatting/substitution

Open bkdotcom opened this issue 8 years ago • 2 comments

https://console.spec.whatwg.org/#formatter

Ie, this header X-Wf-1-1-1-76:179|[{"Type":"LOG","Label":"%o substitution %.2f %ctest"},[["foo","bar"],1.1,"background-color:#00f; font-weight:bold; color:#fff; padding:0 .25em;"]]|

should be equivalent to console.log("%o substitution %.2f %ctest", ["foo","bar"], 1.1, "background-color:#00f; font-weight:bold; color:#fff; padding:0 .25em;")

not "firephp" per say, but since it's just getting passed to the console...

right now it outputs "▸ Array(3) substitution %.2f %ctest"
where the array contains the 3 substitution values

Edit: der... I believe it's because, since firephp only supports "label: value"... I'm passing more than 2 arguments as a list/array for the "value"

bkdotcom avatar Aug 18 '17 15:08 bkdotcom

Sorry - I've been so late on getting to your issues with this :) I'm gonna be looking at this in the next few days/weeks hopefully. Sorry for the delay.

aaronsaray avatar Aug 21 '17 19:08 aaronsaray

@aaronsaray I updated my report with an edit.. the problem is that FirePHP only supports at-most two arguments label + value *.

on the backend, if I have more than 2 arguments, I pass all the the non-label args as a list for the value value

* (as far as I know.. documentation seems to have disappeared and reference implementation is dead):

you could hack around this by checking if the label argument matches this regex

	var subRegex = new RegExp('%' +
		'[+-]?' +               // sign specifier
		'(?:[ 0]|\'.)?' +    // padding specifier
		'-?' +                  // alignment specifier
		'\\d*' +                 // width specifier
		'(?:\\.\\d+)?' +          // precision specifier
		'[difscoO]'           // type
            );

... then if the value attribute is an array/list... treat it as the list of additional arguments

probably not worth the trouble

bkdotcom avatar Aug 21 '17 20:08 bkdotcom