mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-04 17:20:55 +07:00
Revert "[starter] Remove timestamps from the internal logging"
This reverts commit 29242b098093a3ead2054e775a028883f7a6b45b. GitOrigin-RevId: 17b83215820482d31137f53d094350f96941a24c
This commit is contained in:
committed by
intellij-monorepo-bot
parent
ff28e270b6
commit
1d6d33cfb3
@@ -1,5 +1,20 @@
|
|||||||
package com.intellij.tools.ide.util.common
|
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() {
|
fun logOutput() {
|
||||||
logOutput("")
|
logOutput("")
|
||||||
}
|
}
|
||||||
@@ -8,23 +23,15 @@ fun logOutput(any: Any?) {
|
|||||||
logOutput(any?.toString() ?: "null")
|
logOutput(any?.toString() ?: "null")
|
||||||
}
|
}
|
||||||
|
|
||||||
fun logOutput(message: String) {
|
fun logOutput(message: String) = log(message) { println(it) }
|
||||||
println(message)
|
|
||||||
}
|
|
||||||
|
|
||||||
/** The same as [logOutput] but concatenates the string representation of objects */
|
/** The same as [logOutput] but concatenates the string representation of objects */
|
||||||
fun logOutput(vararg objects: Any) {
|
fun logOutput(vararg objects: Any) = log(objects.joinToString(" ")) { println(it) }
|
||||||
println(objects.joinToString(" "))
|
|
||||||
}
|
|
||||||
|
|
||||||
fun logError(any: Any?) {
|
fun logError(any: Any?) = log(any?.toString() ?: "null") { System.err.println(it) }
|
||||||
System.err.println(any?.toString() ?: "null")
|
|
||||||
}
|
|
||||||
|
|
||||||
fun logError(message: String) {
|
fun logError(message: String) = log(message) { System.err.println(it) }
|
||||||
System.err.println(message)
|
|
||||||
}
|
|
||||||
fun logError(message: String, t: Throwable?) {
|
fun logError(message: String, t: Throwable?) {
|
||||||
System.err.println(message)
|
log(message) { System.err.println(it) }
|
||||||
t?.printStackTrace(System.err)
|
t?.printStackTrace(System.err)
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user