Skip to content

Commit d9a830e

Browse files
committed
Add log function prefix "With" for heuristic logger
1 parent cf84c08 commit d9a830e

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

go/ql/lib/semmle/go/Concepts.qll

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -397,15 +397,18 @@ private class DefaultLoggerCall extends LoggerCall::Range, DataFlow::CallNode {
397397
*/
398398
private class HeuristicLoggerCall extends LoggerCall::Range, DataFlow::CallNode {
399399
HeuristicLoggerCall() {
400-
exists(Method m, string tp, string logLevel, string name |
400+
exists(Method m, string tp, string logFunctionPrefix, string name |
401401
m = this.getTarget() and
402402
m.hasQualifiedName(_, tp, name) and
403403
m.getReceiverBaseType().getUnderlyingType() instanceof InterfaceType
404404
|
405405
tp.regexpMatch(".*[lL]ogger") and
406-
logLevel =
407-
["Debug", "Error", "Fatal", "Info", "Log", "Output", "Panic", "Print", "Trace", "Warn"] and
408-
name.matches(logLevel + "%")
406+
logFunctionPrefix =
407+
[
408+
"Debug", "Error", "Fatal", "Info", "Log", "Output", "Panic", "Print", "Trace", "Warn",
409+
"With"
410+
] and
411+
name.matches(logFunctionPrefix + "%")
409412
)
410413
}
411414

0 commit comments

Comments
 (0)