Chrome 中的同步控制台日志记录 [英] Synchronous console logging in Chrome

查看:25
本文介绍了Chrome 中的同步控制台日志记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以同步登录到控制台?我经常遇到代码执行比转储结构更快的情况.这解决了输出已更改的对象.

Is it posible to make logging to the console synchronous? I often run into situations where the code execution is faster than dumping the structures. That resolves in outputting already changed objects.

我肯定可以使用调试器遍历代码,进行单元测试等,通常只需简单的 console.log 内容就可以方便地了解正在发生的事情.>

I sure can walk through the code with debugger, make unit tests etc., it's just often convenient to simply console.log stuff just to make a general idea of what is going on.

推荐答案

您可以在将对象传递给 console.log 之前创建该对象的副本.看这里 用于创建对象深层副本的函数.

You could create a copy of the object before passing it to console.log. Look here for a function to create a deep copy of your object.

现已在 Chrome 中实现,请参阅此处

Now implemented in Chrome, see here

这篇关于Chrome 中的同步控制台日志记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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