My favorites | Sign in
Project Home Wiki Issues
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 409: sprintf implementation for firebug console.log
8 people starred this issue and may be notified of changes. Back to list
 
Reported by urkle0, Dec 12, 2007
Attached is a fairly complete sprintf implementation I wrote that allows
fully formated % variables in strings.  You can use this code to add
support for numeric formatting, etc in console.log. 

And by fairly complete, I think the only thing I didn't implement is 'p'
(pointer) as that isn't possible in JS
sprintf.js
8.3 KB   View   Download
Dec 12, 2007
Project Member #1 johnjbar...@johnjbarton.com
Thanks! Please include your name, email address, and license info (eg BSD
http://fbug.googlecode.com/svn/trunk/license.txt) in the text of the .js file.
Also, if you work under contract (eg employed by a company), please add your
affiliation information; many multinationals think they own everything you do ;-).

I don't know if we will use this, because I don't know if there would be enough users
to balance the effort to maintain it.  Test cases and requests from users would help.

John.
Labels: -Type-Defect Type-Enhancement console
Jan 11, 2008
#2 urkle0
OK, I've updated the file w/ a BSD License.
I'll write up a few test cases to demonstrate the functionality.

I'd be willing to maintain it w/o an issue.. Plus the way I've designed the 
implementation it is very easy to extend w/ new letters (like the existing '%o')



sprintf.js
10.0 KB   View   Download
Mar 17, 2008
Project Member #3 johnjbar...@johnjbarton.com
(No comment was entered for this change.)
Labels: contribution
Nov 27, 2008
#4 antonin....@gmail.com
If it doesn't manage to get into core, would be nice to have it as FB extension.
Aug 30, 2011
#5 sebastia...@gmx.de
urkle0, if you're still interested in this after that long time, I'd suggest you create a patch against the 1.9 branch.
The current Firebug implementation looks like this:
https://code.google.com/p/fbug/source/browse/branches/firebug1.9/content/firebug/console/console.js?spec=svn11640&r=11634#1114

So just to note: console.log() already has some formatting since version 1, but the current implementation doesn't allow for more complex formatting.
See http://getfirebug.com/wiki/index.php/Console_API#console.log.28object.5B.2C_object.2C_....5D.29 for more info about this.
Status: Triaged
Cc: sebastia...@gmx.de
Labels: Test-case-needed
Mar 23, 2013
Project Member #6 sebastia...@gmail.com
(No comment was entered for this change.)
Cc: -sebastia...@gmx.de sebastia...@gmail.com
Sign in to add a comment

Powered by Google Project Hosting