mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[IJPL] Add logger tracing helpers
(cherry picked from commit 1bf41fd81af1a57b4375014c9b5017895f723dc0) IJ-MR-134201 GitOrigin-RevId: 26cf466cfa7550d5d1f2a2f803af94cb420d35fe
This commit is contained in:
committed by
intellij-monorepo-bot
parent
749b863cb6
commit
ea9be2b5e6
@@ -543,8 +543,10 @@ f:com.intellij.openapi.diagnostic.LoggerKt
|
||||
- bs:debug$default(com.intellij.openapi.diagnostic.Logger,java.lang.Exception,kotlin.jvm.functions.Function0,I,java.lang.Object):V
|
||||
- sf:fileLogger():com.intellij.openapi.diagnostic.Logger
|
||||
- sf:getOrLogException(java.lang.Object,com.intellij.openapi.diagnostic.Logger):java.lang.Object
|
||||
- sf:ifTraceEnabled(com.intellij.openapi.diagnostic.Logger,kotlin.jvm.functions.Function0):java.lang.Object
|
||||
- sf:runAndLogException(com.intellij.openapi.diagnostic.Logger,kotlin.jvm.functions.Function0):java.lang.Object
|
||||
- sf:trace(com.intellij.openapi.diagnostic.Logger,kotlin.jvm.functions.Function0):V
|
||||
- sf:traceThrowable(com.intellij.openapi.diagnostic.Logger,kotlin.jvm.functions.Function0):V
|
||||
*:com.intellij.openapi.diagnostic.ReportingClassSubstitutor
|
||||
- s:getClassToReport(java.lang.Object):java.lang.Class
|
||||
- a:getSubstitutedClass():java.lang.Class
|
||||
|
||||
@@ -67,6 +67,20 @@ inline fun Logger.trace(@NonNls lazyMessage: () -> String) {
|
||||
}
|
||||
}
|
||||
|
||||
/* Cannot name it `trace` due to the clash with the function above */
|
||||
inline fun Logger.traceThrowable(lazyThrowable: () -> Throwable) {
|
||||
if (isTraceEnabled) {
|
||||
return trace(lazyThrowable())
|
||||
}
|
||||
}
|
||||
|
||||
inline fun <T : Any> Logger.ifTraceEnabled(lazyValue: () -> T): T? {
|
||||
if (isTraceEnabled) {
|
||||
return lazyValue()
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
/** Consider using [Result.getOrLogException] for more straight-forward API instead. */
|
||||
inline fun <T> Logger.runAndLogException(runnable: () -> T): T? {
|
||||
return runCatching {
|
||||
|
||||
Reference in New Issue
Block a user