获取Chrome的console.log以显示调用函数的行 [英] Getting Chrome's console.log to display the line that called a function

查看:248
本文介绍了获取Chrome的console.log以显示调用函数的行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Chrome控制台标签中是否有任何方法可以显示称为函数的地址?

Is there any way in the Chrome Console tab to display the address that called a function?

我有一个正在被调用的函数,但是我不知道从哪里来.我知道我可以中断并查看调用堆栈",但我只想在每个调用它的条目上显示:

I have a function that's being called but I don't know where from. I know I could break and look at the Call Stack but I'd rather just display at each entry who called it:

functon select_el() {
console.log("select_el called by " + ?????);

    etc.
}

谢谢

推荐答案

我认为您不能使用console.log()做到这一点.如果您对红色输出没问题,请尝试使用console.error().

I don't think you can do that with console.log(). Try with console.error() if you're fine with red output.

这篇关于获取Chrome的console.log以显示调用函数的行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆