Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Log a link to a source code in Firefox console

I am currently writing a logger that uses a console.log(). As I call to logger method instead of a console.log(), every log line shows the same position on the source code that corresponds to the linea where is the call to console.log(). I would like to include a link in the message that can show the line which is the origin of the log.

In Google Chrome it is possible to log an URL with a line number and column number (separated by colon) and it is automatically converted to a link. If I click on the link, I can view the source code at the specified line. Here is an example:

// press F12 and click on link in the console log, this will open the source code in the "Sources" tab at line-column 3:5
console.log('http://akfs.nspmotion.com/test/example.js:3:5');
<script src="http://akfs.nspmotion.com/test/example.js"></script>

Is there any way to achieve something like this in the Firefox console?

like image 296
jcbp Avatar asked Oct 27 '25 19:10

jcbp


1 Answers

The feature that logged URLs including row and column information are linked to the Debugger doesn't exist yet in the Firefox DevTools. Therefore I've requested it now in bug 1360447.

like image 86
Sebastian Zartner Avatar answered Oct 30 '25 10:10

Sebastian Zartner