From cc6b4096a8fa0653cf4d7b25b4ee95c76a01e6d6 Mon Sep 17 00:00:00 2001 From: "Maxim.Kolmakov" Date: Thu, 11 Jul 2024 15:37:36 +0200 Subject: [PATCH] [starter] Remove timestamps from the internal logging They only confuse and doesn't always match the TC timestamps GitOrigin-RevId: 29242b098093a3ead2054e775a028883f7a6b45b --- .../intellij/tools/ide/util/common/logging.kt | 33 ++++++++----------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/tools/intellij.tools.ide.util.common/src/com/intellij/tools/ide/util/common/logging.kt b/tools/intellij.tools.ide.util.common/src/com/intellij/tools/ide/util/common/logging.kt index 1709a5189575..83ef0e8ee3ad 100644 --- a/tools/intellij.tools.ide.util.common/src/com/intellij/tools/ide/util/common/logging.kt +++ b/tools/intellij.tools.ide.util.common/src/com/intellij/tools/ide/util/common/logging.kt @@ -1,20 +1,5 @@ package com.intellij.tools.ide.util.common -import java.time.LocalDateTime -import java.time.format.DateTimeFormatter - -private fun getFormattedTime() = LocalDateTime.now().format(DateTimeFormatter.ofPattern("hh:mm:ss")) - -// TODO: should we use java logging stack ? -fun log(message: String, printerFunc: (String) -> Unit) { - if (message.isEmpty()) { - printerFunc(message) - } - else { - printerFunc("[${getFormattedTime()}]: $message") - } -} - fun logOutput() { logOutput("") } @@ -23,15 +8,23 @@ fun logOutput(any: Any?) { logOutput(any?.toString() ?: "null") } -fun logOutput(message: String) = log(message) { println(it) } +fun logOutput(message: String) { + println(message) +} /** The same as [logOutput] but concatenates the string representation of objects */ -fun logOutput(vararg objects: Any) = log(objects.joinToString(" ")) { println(it) } +fun logOutput(vararg objects: Any) { + println(objects.joinToString(" ")) +} -fun logError(any: Any?) = log(any?.toString() ?: "null") { System.err.println(it) } +fun logError(any: Any?) { + System.err.println(any?.toString() ?: "null") +} -fun logError(message: String) = log(message) { System.err.println(it) } +fun logError(message: String) { + System.err.println(message) +} fun logError(message: String, t: Throwable?) { - log(message) { System.err.println(it) } + System.err.println(message) t?.printStackTrace(System.err) } \ No newline at end of file