panbingkun commented on code in PR #45837:
URL: https://github.com/apache/spark/pull/45837#discussion_r1549084616


##########
mllib/src/main/scala/org/apache/spark/ml/util/Instrumentation.scala:
##########
@@ -84,20 +84,53 @@ private[spark] class Instrumentation private () extends 
Logging with MLEvents {
     super.logWarning(prefix + msg)
   }
 
+  /**
+   * Logs a LogEntry which message with a prefix that uniquely identifies the 
training session.
+   */
+  override def logWarning(entry: LogEntry): Unit = {
+    if (log.isWarnEnabled) {
+      withLogContext(entry.context) {
+        log.warn(prefix + entry.message)
+      }
+    }
+  }
+
   /**
    * Logs a error message with a prefix that uniquely identifies the training 
session.
    */
   override def logError(msg: => String): Unit = {
     super.logError(prefix + msg)
   }
 
+  /**
+   * Logs a LogEntry which message with a prefix that uniquely identifies the 
training session.
+   */
+  override def logError(entry: LogEntry): Unit = {

Review Comment:
   Maybe we can write it as follows:
   ```
   override def logError(entry: LogEntry): Unit = {
      super.logError(MessageWithContext(prefix + entry.message, entry.context))
   }
   ```
   But it seems that the `efficiency` is not as high as mentioned above.



-- 
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