dtenedor commented on code in PR #45866:
URL: https://github.com/apache/spark/pull/45866#discussion_r1554389128


##########
common/utils/src/main/scala/org/apache/spark/internal/Logging.scala:
##########
@@ -151,10 +165,26 @@ trait Logging {
     if (log.isDebugEnabled) log.debug(msg)
   }
 
+  protected def logDebug(entry: LogEntry): Unit = {

Review Comment:
   Done.



##########
common/utils/src/main/scala/org/apache/spark/internal/Logging.scala:
##########
@@ -151,10 +165,26 @@ trait Logging {
     if (log.isDebugEnabled) log.debug(msg)
   }
 
+  protected def logDebug(entry: LogEntry): Unit = {
+    if (log.isDebugEnabled) {
+      withLogContext(entry.context) {
+        log.debug(entry.message)
+      }
+    }
+  }
+
   protected def logTrace(msg: => String): Unit = {
     if (log.isTraceEnabled) log.trace(msg)
   }
 
+  protected def logTrace(entry: LogEntry): Unit = {

Review Comment:
   Done.



##########
common/utils/src/main/scala/org/apache/spark/internal/Logging.scala:
##########
@@ -43,19 +43,33 @@ case class MDC(key: LogKey, value: Any)
  * Wrapper class for log messages that include a logging context.
  * This is used as the return type of the string interpolator 
`LogStringContext`.
  */
-case class MessageWithContext(message: String, context: 
java.util.HashMap[String, String]) {
+case class MessageWithContext(
+    message: String,
+    context: java.util.HashMap[String, String],
+    stripMarginFromMessage: Boolean = false) {
   def +(mdc: MessageWithContext): MessageWithContext = {
     val resultMap = new java.util.HashMap(context)
     resultMap.putAll(mdc.context)
-    MessageWithContext(message + mdc.message, resultMap)
+    MessageWithContext(
+      message + mdc.message,
+      resultMap,
+      mdc.stripMarginFromMessage || stripMarginFromMessage)
   }
+
+  def stripMargin: MessageWithContext = copy(stripMarginFromMessage = true)

Review Comment:
   Good idea, this is done.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to