chromium vlog 替換 log(info)

chromium vlog log 打印輸出調試

在Chromium中,DVLOG(20)是一種用於打印詳細日誌信息的宏。

這個宏的具體含義是在調試(Debug)版本中打印日誌,而在發佈(Release)版本中會被優化掉,因此在正式發佈的軟件中是不會產生這些日誌的。

DVLOG是Debug Verbose Logging的縮寫,它用於在調試模式下記錄詳細的日誌信息。數字20表示日誌的詳細程度,具體的含義可能因上下文而異。通常,較低的數字表示更詳細的日誌。

要過濾或查看特定級別的DVLOG日誌,你可以使用Chromium提供的日誌過濾工具。在Chromium中,你可以使用以下命令來過濾特定級別的日誌:

php
--vmodule=<module_name>=<verbosity_level>

在這裏,<module_name>是你感興趣的模塊名稱,可以是文件名或其他標識符,<verbosity_level>是你想要記錄的詳細級別。

例如,如果你想查看所有模塊的DVLOG(20)日誌,可以使用以下命令:

css
--vmodule=*=20

請注意,這些命令通常在運行Chromium的啓動命令行中使用。你可以根據自己的需要調整過濾條件。


 

 

https://groups.google.com/a/chromium.org/g/chromium-dev/c/3NDNd1KzXeY?pli=1

 

Until recently some people have been using LOG(INFO) as "debug logging", since the default logging level was WARNING, which didn't print INFO messages.  However, there are problems with this:
  • If everyone does this, then when you set the log level to INFO to try to debug, you're deluged with messages.
  • Semantically, LOG() is supposed to be more for "messages that should always be printed", and INFO means "informative" rather than "debug" or "not printed in normal usage".
This has become a serious issue recently as we've changed the default LOG level to INFO.  Now Chrome builds are much noisier.  This is at least annoying, and in some cases worse as some users have reported slowdowns due to console log spam.
 
Instead of using LOG(INFO) for debugging, or some set of #defines that map MY_CUSTOM_LOG to various values including LOG(INFO), use VLOG.  VLOG is a recently-added facility that allows for extremely fine-grained logging control:
  • VLOG() levels can be adjusted on a per-module basis at runtime.
  • VLOG() takes an arbitrary integer value (higher numbers should be used for more verbose logging), so you can make your logging levels as granular as you wish.
Example usage:
 
./chrome --v=1 --vmodule=foo=2,bar=3
 
This runs Chrome with the global VLOG level set to "print everything at level 1 and lower", but prints levels up to 2 in foo.cc and levels up to 3 in bar.cc.
 
I have a set of changes locally, which I'll be working to check in, which globally convert LOG(INFO) to VLOG(1).  Please feel free to make drive-by comments on the code reviews if you know of code where this conversion is wrong, the VLOG level should be different than 1, the logging should just be removed, or any other non-default case.  In a few cases where people #defined their own logging facilities I have converted those and stripped the controlling macros (as VLOG's per-module control generally renders them obsolete).
 

Basically, if a
--vmodule pattern has a slash*, it will try to match the entire path
against it instead of just the module name. Note that this means
you'll almost always need to use wildcards for directory patterns,
e.g. --vmodule=*/chromeos/*=2,*chrome/browser/sync*=3.

* forward or back slash, but it must match your current platform --
I'll fix this in a future CL


chrome devtools面板適用說明,包括wasm c++調試

Chrome 調試技巧


 

vs-chromium 代碼搜索

下載vs版本的代碼explorer和search插件,會安裝到vs2013以上版本:

http://chromium.github.io/vs-chromium/#index

下載地址:https://github.com/chromium/vs-chromium/releases/latest

啓動exe文件:

cefclient.exe  -url=https://www.baidu.com  --enable-logging --v=1

加入斷點即可。

vs-chromium-project.txt 

裏面寫入:

[SearchableFiles.include]
*

 

文檔:http://chromium.github.io/vs-chromium/#getting-started


 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章