add dbg flag for llcppsigfetch, llcppsymg, gogensig to control log #245
add dbg flag for llcppsigfetch, llcppsymg, gogensig to control log #245tsingbx wants to merge 2 commits intogoplus:mainfrom
Conversation
_xtool/llcppsymg/dbg/debug.go
Outdated
| DbgSymbol dbgFlags = 1 << iota | ||
| DbgParseIsMethod //print parse.go isMethod debug log info | ||
| DbgFlagAll = DbgSymbol | DbgParseIsMethod | ||
| DbgEditSymMap //print user edit sym map info | ||
| DbgVisitTop //print visitTop | ||
| DbgCollectFuncInfo | ||
| DbgNewSymbol | ||
| DbgFileType | ||
| DbgFlagAll = DbgSymbol | DbgParseIsMethod |
There was a problem hiding this comment.
之前的DbgFlagAll = DbgSymbol | DbgParseIsMethod 是因为只有两个flag,现在的DbgFlagAll其实就不应该这么写了,而是应该组合前面所有的Flag。
https://github.com/goplus/gogen/blob/ba6f4f0b5b8a936aac433e2b202a9de05ab0915a/package.go#L30C1-L40C2
There was a problem hiding this comment.
之前的DbgFlagAll = DbgSymbol | DbgParseIsMethod 是因为只有两个flag,现在的DbgFlagAll其实就不应该这么写了,而是应该组合前面所有的Flag。
https://github.com/goplus/gogen/blob/ba6f4f0b5b8a936aac433e2b202a9de05ab0915a/package.go#L30C1-L40C2
这个在开发调试的时候可以修改。对于产品发布,或者对于测试输出就禁止了吧。否则log太多对排查问题来说很不方便。这是故意这样做的。
There was a problem hiding this comment.
DbgFlagAll的语义就会不明确
怎么不明确了,这个DbgFlagAll是由你控制的一个flag,如果是0,就是不输出log,如果是DbgVisitTop|DbgFileType,就是输出其他,这个DbgFlagAll的意思就是所有要输出的log的意思。
There was a problem hiding this comment.
There was a problem hiding this comment.
根据最新的这个提交,在位标志中,0表示“没有标志被设置”。如果 DbgAll 定义为0,就意味着没有一个调试标志被启用,这与“所有标志都开启”的意思完全相反。因此,为了表示所有调试标志都被激活,DbgAll 必须由所有标志的非零值按位“或”得到,而不能简单地用0表示。
这个是故意这样做的,只有在调试的时候,才需要输出log,按照你想输出什么log,DbgFlagAll=flagA|flagB,只输出A和B的log。然后运行的时候添加-v标志,只输出你想要的log。
cmd/gogensig/dbg/debug.go
Outdated
| DbgNew | ||
| DbgWrite | ||
| DbgUnmarshalling | ||
| DbgFlagAll = 0 | DbgError | DbgLog |
| DbgLog // print log info | ||
| DbgFlagAll = 0 | DbgError | DbgLog | ||
| DbgSetCurFile | ||
| DbgNew |
_xtool/llcppsigfetch/dbg/debug.go
Outdated
| DbgGetCurFile | ||
| DbgMacro | ||
| DbgFileType | ||
| DbgFlagAll = DbgParse |
375284d to
333ba03
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #245 +/- ##
==========================================
- Coverage 78.84% 77.52% -1.32%
==========================================
Files 31 31
Lines 2940 2959 +19
==========================================
- Hits 2318 2294 -24
- Misses 604 630 +26
- Partials 18 35 +17 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|


No description provided.