Skip to content

Commit 47710c9

Browse files
committed
[SPARK-48592][INFRA] Add scala style check for logging message inline variables
1 parent 6107836 commit 47710c9

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

scalastyle-config.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,14 @@ This file is divided into 3 sections:
155155
<customMessage><![CDATA[MDC should be used in string interpolation log"..." instead of s"..."]]></customMessage>
156156
</check>
157157

158+
<check customId="logInlineVariable" level="error" class="org.scalastyle.file.RegexChecker" enabled="true">
159+
<parameters><parameter name="regex">log(?:Info|Warning|Error)\(s".*(\$|\+\s*[^\s"]).*"\)</parameter></parameters>
160+
<customMessage>
161+
Logging message should use log"..." instead of s"..." and variables should be wrapped in `MDC`s.
162+
Refer to Structured Logging Framework guidelines in the file `internal/Logging.scala`.
163+
</customMessage>
164+
</check>
165+
158166
<check customId="hadoopconfiguration" level="error" class="org.scalastyle.file.RegexChecker" enabled="true">
159167
<parameters><parameter name="regex">spark(.sqlContext)?.sparkContext.hadoopConfiguration</parameter></parameters>
160168
<customMessage><![CDATA[

0 commit comments

Comments
 (0)