From efaeb0435e64d00b8a9a1140ba03d1df0d936efc Mon Sep 17 00:00:00 2001 From: Akash Yadav Date: Tue, 7 Nov 2023 19:01:45 +0530 Subject: [PATCH] refactor(logger): rename ILogger.Priority to ILogger.Level --- .../fragments/output/IDELogFragment.kt | 6 +- .../fragments/output/LogViewFragment.kt | 6 +- .../services/builder/GradleBuildService.kt | 2 +- changelogs/v2.1.0-beta.md | 2 +- changelogs/v2.1.2-beta.md | 2 +- changelogs/v2.4.0-beta.md | 2 +- .../editor/treesitter/log/highlights.scm | 40 ++++++------- .../androidide/utils/AndroidLogger.java | 4 +- .../com/itsaky/androidide/utils/ILogger.java | 60 +++++++++---------- .../itsaky/androidide/utils/JvmLogger.java | 8 +-- resources/src/main/res/raw/attrs_xml.txt | 8 +-- .../com/itsaky/androidide/models/LogLine.kt | 18 +++--- .../xalan/internal/xsltc/compiler/xpath.cup | 12 ++-- .../itsaky/androidide/tooling/impl/Main.java | 7 +-- .../impl/MultiModuleAndroidProjectTest.kt | 9 +-- .../tooling/api/messages/LogMessageParams.kt | 2 +- .../lsp/api/util/ReflectiveLogListener.kt | 8 +-- .../tooling/testing/ToolingApiTestLauncher.kt | 2 +- 18 files changed, 95 insertions(+), 103 deletions(-) diff --git a/app/src/main/java/com/itsaky/androidide/fragments/output/IDELogFragment.kt b/app/src/main/java/com/itsaky/androidide/fragments/output/IDELogFragment.kt index 157ac1bb91..52edec0a73 100644 --- a/app/src/main/java/com/itsaky/androidide/fragments/output/IDELogFragment.kt +++ b/app/src/main/java/com/itsaky/androidide/fragments/output/IDELogFragment.kt @@ -29,14 +29,14 @@ import com.itsaky.androidide.utils.ILogger class IDELogFragment : LogViewFragment() { private var logListener: ILogger.LogListener? = - ILogger.LogListener { priority, tag, message -> + ILogger.LogListener { level, tag, message -> if (message.contains("\n")) { val split = message.split("\n").toTypedArray() for (line in split) { - logLine(priority, tag, line) + logLine(level, tag, line) } } else { - logLine(priority, tag, message) + logLine(level, tag, message) } } diff --git a/app/src/main/java/com/itsaky/androidide/fragments/output/LogViewFragment.kt b/app/src/main/java/com/itsaky/androidide/fragments/output/LogViewFragment.kt index 9fc03c34dd..ce9c2c3e3a 100644 --- a/app/src/main/java/com/itsaky/androidide/fragments/output/LogViewFragment.kt +++ b/app/src/main/java/com/itsaky/androidide/fragments/output/LogViewFragment.kt @@ -29,7 +29,7 @@ import com.itsaky.androidide.editor.schemes.IDEColorSchemeProvider import com.itsaky.androidide.fragments.EmptyStateFragment import com.itsaky.androidide.models.LogLine import com.itsaky.androidide.utils.ILogger -import com.itsaky.androidide.utils.ILogger.Priority +import com.itsaky.androidide.utils.ILogger.Level import com.itsaky.androidide.utils.jetbrainsMono import io.github.rosemoe.sora.widget.style.CursorAnimator import java.util.concurrent.ArrayBlockingQueue @@ -195,8 +195,8 @@ abstract class LogViewFragment : abstract fun isSimpleFormattingEnabled(): Boolean - protected open fun logLine(priority: Priority, tag: String, message: String) { - val line = LogLine.obtain(priority, tag, message) + protected open fun logLine(level: Level, tag: String, message: String) { + val line = LogLine.obtain(level, tag, message) appendLog(line) } diff --git a/app/src/main/java/com/itsaky/androidide/services/builder/GradleBuildService.kt b/app/src/main/java/com/itsaky/androidide/services/builder/GradleBuildService.kt index fe907456ef..bb237d6804 100644 --- a/app/src/main/java/com/itsaky/androidide/services/builder/GradleBuildService.kt +++ b/app/src/main/java/com/itsaky/androidide/services/builder/GradleBuildService.kt @@ -236,7 +236,7 @@ class GradleBuildService : Service(), BuildService, IToolingApiClient, override fun logMessage(params: LogMessageParams) { val line = params.toLogLine() - serverLogger.log(line.priority, line.formattedTagAndMessage()) + serverLogger.log(line.level, line.formattedTagAndMessage()) } override fun logOutput(line: String) { diff --git a/changelogs/v2.1.0-beta.md b/changelogs/v2.1.0-beta.md index 5a01b1758b..a7859d1d2d 100644 --- a/changelogs/v2.1.0-beta.md +++ b/changelogs/v2.1.0-beta.md @@ -41,7 +41,7 @@ AndroidIDE v2.0.0-beta is here with new features, improvements, bug fixes and a - `Import orderer`: Organizes the imports. Thanks to @MrIkso (#180). - XML Code formatter. Thanks to @MrIkso (#182). - New Gradle command line options: `--build-cache` and `--offline`. Thanks to @MrIkso (#180). -- Highlight IDE logs based on the log line priority. +- Highlight IDE logs based on the log line level. - Option to share Build Output, App log and IDE logs as text file. - Syntax highlighting for Kotlin and C/C++ language. Thanks to @MrIkso (#196). - Highlight hex color code in string literals. Thanks to @MrIkso (#209). diff --git a/changelogs/v2.1.2-beta.md b/changelogs/v2.1.2-beta.md index 52513a81ac..067425c199 100644 --- a/changelogs/v2.1.2-beta.md +++ b/changelogs/v2.1.2-beta.md @@ -56,7 +56,7 @@ Following issues have been fixed in this release : - Hide tab layout when no files are opened (#330). - Do not show full error message when layout inflation fails (#274). - Use Storage Access Framework (SAF) for picking directories. -- 'Preview layout' item now has more priority than other options menu icons (#243). +- 'Preview layout' item now has more level than other options menu icons (#243). - Do not show editor actions window when in search mode. - Use relative padding in TreeView to support RTL layouts. - Updated crash report. By @AndreyKozhev (#460). diff --git a/changelogs/v2.4.0-beta.md b/changelogs/v2.4.0-beta.md index 51d169609b..625af84cd5 100644 --- a/changelogs/v2.4.0-beta.md +++ b/changelogs/v2.4.0-beta.md @@ -35,5 +35,5 @@ _No notes_ ## Improvements - Improved colors in editor windows. -- Signture help window is now given more priority over the diagnostics window. This means, if the signature help window is visible to the user, the diagnostics window will not be shown. +- Signture help window is now given more level over the diagnostics window. This means, if the signature help window is visible to the user, the diagnostics window will not be shown. - The IDE now releases some unnecessary resources when a file is deleted or renamed. \ No newline at end of file diff --git a/editor/src/main/assets/editor/treesitter/log/highlights.scm b/editor/src/main/assets/editor/treesitter/log/highlights.scm index 3fbda2ebfc..5b4f875071 100644 --- a/editor/src/main/assets/editor/treesitter/log/highlights.scm +++ b/editor/src/main/assets/editor/treesitter/log/highlights.scm @@ -5,10 +5,10 @@ (time) @err.time (pid) @err.pid (tid) @err.tid - (priority) @err.priority + (level) @err.level (tag) @err.tag (message) @err.msg - (#match? @err.priority "E") + (#match? @err.level "E") ) (log_line @@ -16,10 +16,10 @@ (time) @warn.time (pid) @warn.pid (tid) @warn.tid - (priority) @warn.priority + (level) @warn.level (tag) @warn.tag (message) @warn.msg - (#match? @warn.priority "W") + (#match? @warn.level "W") ) (log_line @@ -27,10 +27,10 @@ (time) @info.time (pid) @info.pid (tid) @info.tid - (priority) @info.priority + (level) @info.level (tag) @info.tag (message) @info.msg - (#match? @info.priority "I") + (#match? @info.level "I") ) (log_line @@ -38,10 +38,10 @@ (time) @debug.time (pid) @debug.pid (tid) @debug.tid - (priority) @debug.priority + (level) @debug.level (tag) @debug.tag (message) @debug.msg - (#match? @debug.priority "D") + (#match? @debug.level "D") ) (log_line @@ -49,43 +49,43 @@ (time) @verbose.time (pid) @verbose.pid (tid) @verbose.tid - (priority) @verbose.priority + (level) @verbose.level (tag) @verbose.tag (message) @verbose.msg - (#match? @verbose.priority "V") + (#match? @verbose.level "V") ) (ide_log_line (ide_tag) @err.tag - (priority) @err.priority + (level) @err.level (message) @err.msg - (#match? @err.priority "E") + (#match? @err.level "E") ) (ide_log_line (ide_tag) @warn.tag - (priority) @warn.priority + (level) @warn.level (message) @warn.msg - (#match? @warn.priority "W") + (#match? @warn.level "W") ) (ide_log_line (ide_tag) @info.tag - (priority) @info.priority + (level) @info.level (message) @info.msg - (#match? @info.priority "I") + (#match? @info.level "I") ) (ide_log_line (ide_tag) @debug.tag - (priority) @debug.priority + (level) @debug.level (message) @debug.msg - (#match? @debug.priority "D") + (#match? @debug.level "D") ) (ide_log_line (ide_tag) @verbose.tag - (priority) @verbose.priority + (level) @verbose.level (message) @verbose.msg - (#match? @verbose.priority "V") + (#match? @verbose.level "V") ) \ No newline at end of file diff --git a/logger/src/main/java/com/itsaky/androidide/utils/AndroidLogger.java b/logger/src/main/java/com/itsaky/androidide/utils/AndroidLogger.java index 46685374b6..c4c13d4cd2 100644 --- a/logger/src/main/java/com/itsaky/androidide/utils/AndroidLogger.java +++ b/logger/src/main/java/com/itsaky/androidide/utils/AndroidLogger.java @@ -31,8 +31,8 @@ protected AndroidLogger(String tag) { } @Override - protected void doLog(Priority priority, String message) { - switch (priority) { + protected void doLog(Level level, String message) { + switch (level) { case ERROR: Log.e(TAG, message); break; diff --git a/logger/src/main/java/com/itsaky/androidide/utils/ILogger.java b/logger/src/main/java/com/itsaky/androidide/utils/ILogger.java index c70d2a9723..dc6f9a8151 100644 --- a/logger/src/main/java/com/itsaky/androidide/utils/ILogger.java +++ b/logger/src/main/java/com/itsaky/androidide/utils/ILogger.java @@ -97,45 +97,45 @@ public static ILogger newInstance(String tag) { * @return This logger instance. */ public ILogger error(Object... messages) { - return log(Priority.ERROR, messages); + return log(Level.ERROR, messages); } /** - * Log messages with the given priority. + * Log messages with the given log level. * - * @param priority The priority of the log messages. + * @param level The log level of the messages. * @param messages The messages to log. * @return This logger instance. */ - public ILogger log(Priority priority, Object... messages) { - logAndNotify(priority, generateMessage(messages)); + public ILogger log(Level level, Object... messages) { + logAndNotify(level, generateMessage(messages)); return this; } - private void logAndNotify(Priority priority, String msg) { + private void logAndNotify(Level level, String msg) { if (!isEnabled()) { // logger is disabled return; } - doLog(priority, msg); + doLog(level, msg); for (final var listener : logListeners) { - listener.log(priority, TAG, msg); + listener.log(level, TAG, msg); } } /** * Log the message to an appropriate stream where the user can see the log messages. * - * @param priority The priority for this log message. - * @param message The full generated message for this log. Might contain new lines. - * @see ILogger.Priority#DEBUG - * @see ILogger.Priority#ERROR - * @see ILogger.Priority#WARNING - * @see ILogger.Priority#VERBOSE - * @see ILogger.Priority#INFO + * @param level The log level for this message. + * @param message The full generated message for this log. Might contain new lines. + * @see Level#DEBUG + * @see Level#ERROR + * @see Level#WARNING + * @see Level#VERBOSE + * @see Level#INFO */ - protected abstract void doLog(Priority priority, String message); + protected abstract void doLog(Level level, String message); protected String generateMessage(Object... messages) { StringBuilder sb = new StringBuilder(); @@ -159,7 +159,7 @@ protected String generateMessage(Object... messages) { * @return This logger instance. */ public ILogger warn(Object... messages) { - return log(Priority.WARNING, messages); + return log(Level.WARNING, messages); } /** @@ -169,7 +169,7 @@ public ILogger warn(Object... messages) { * @return This logger instance. */ public ILogger verbose(Object... messages) { - return log(Priority.VERBOSE, messages); + return log(Level.VERBOSE, messages); } /** @@ -179,7 +179,7 @@ public ILogger verbose(Object... messages) { * @return This logger instance. */ public ILogger info(Object... messages) { - return log(Priority.INFO, messages); + return log(Level.INFO, messages); } /** @@ -196,7 +196,7 @@ public void logThis() { * @return This logger instance. */ public ILogger debug(Object... messages) { - return log(Priority.DEBUG, messages); + return log(Level.DEBUG, messages); } /** @@ -234,9 +234,9 @@ protected String getCallerClassDescription() { } /** - * Logging priority. + * Logging level. */ - public enum Priority { + public enum Level { DEBUG('D'), WARNING('W'), @@ -244,21 +244,21 @@ public enum Priority { INFO('I'), VERBOSE('V'); - public final char priorityChar; + public final char levelChar; - Priority(char priorityChar) { - this.priorityChar = priorityChar; + Level(char levelChar) { + this.levelChar = levelChar; } - public static Priority forChar(char c) { + public static Level forChar(char c) { c = Character.toUpperCase(c); - for (Priority value : values()) { - if (value.priorityChar == c) { + for (Level value : values()) { + if (value.levelChar == c) { return value; } } - throw new IllegalArgumentException("Invalid priority char " + c); + throw new IllegalArgumentException("Invalid level char " + c); } } @@ -267,6 +267,6 @@ public static Priority forChar(char c) { */ public interface LogListener { - void log(Priority priority, String tag, String message); + void log(Level level, String tag, String message); } } diff --git a/logger/src/main/java/com/itsaky/androidide/utils/JvmLogger.java b/logger/src/main/java/com/itsaky/androidide/utils/JvmLogger.java index 7d71798df9..2da4ecaa55 100644 --- a/logger/src/main/java/com/itsaky/androidide/utils/JvmLogger.java +++ b/logger/src/main/java/com/itsaky/androidide/utils/JvmLogger.java @@ -33,14 +33,14 @@ protected JvmLogger(String tag) { } @Override - protected void doLog(Priority priority, String message) { + protected void doLog(Level level, String message) { if (interceptor != null) { - interceptor.onLog(priority, TAG, message); + interceptor.onLog(level, TAG, message); } else { System.err.printf( "%-25s %-2s %s%n", trimTagIfNeeded(TAG, 25), - priority.priorityChar, + level.levelChar, message ); } @@ -48,6 +48,6 @@ protected void doLog(Priority priority, String message) { public interface LogInterceptor { - void onLog(Priority priority, String tag, String message); + void onLog(Level level, String tag, String message); } } diff --git a/resources/src/main/res/raw/attrs_xml.txt b/resources/src/main/res/raw/attrs_xml.txt index 0dda0e6c7e..c6dab28b0a 100755 --- a/resources/src/main/res/raw/attrs_xml.txt +++ b/resources/src/main/res/raw/attrs_xml.txt @@ -5445,8 +5445,8 @@

Only a single non-rectangular clip can be applied on a View at any time. Circular clips from a {@link android.view.ViewAnimationUtils#createCircularReveal(View, int, int, float, - float)} circular reveal animation take priority over Outline clipping, and child - Outline clipping takes priority over Outline clipping done by a parent. + float)} circular reveal animation take level over Outline clipping, and child + Outline clipping takes level over Outline clipping done by a parent.

Note that this flag will only be respected if the View's Outline returns true from {@link android.graphics.Outline#canClip()}. --> - diff --git a/shared/src/main/java/com/itsaky/androidide/models/LogLine.kt b/shared/src/main/java/com/itsaky/androidide/models/LogLine.kt index cffbe23adf..613f210b6e 100644 --- a/shared/src/main/java/com/itsaky/androidide/models/LogLine.kt +++ b/shared/src/main/java/com/itsaky/androidide/models/LogLine.kt @@ -30,7 +30,7 @@ class LogLine private constructor() : DefaultRecyclable() { var tid: String? = null var tag: String? = null var message: String? = null - var priority: ILogger.Priority? = null + var level: ILogger.Level? = null var formatted = false // For JSONRpc and Recyclable @@ -40,7 +40,7 @@ class LogLine private constructor() : DefaultRecyclable() { fun toSimpleString(): String { return if (formatted) String.format( - "%-25s %-2s %s", LogTagUtils.trimTagIfNeeded(tag, 25), priority?.priorityChar ?: 'U', + "%-25s %-2s %s", LogTagUtils.trimTagIfNeeded(tag, 25), level?.levelChar ?: 'U', message) else unformatted!! } @@ -57,7 +57,7 @@ class LogLine private constructor() : DefaultRecyclable() { time = null date = null unformatted = null - priority = ILogger.Priority.DEBUG + level = ILogger.Level.DEBUG formatted = false } @@ -69,7 +69,7 @@ class LogLine private constructor() : DefaultRecyclable() { override fun toString(): String { return if (formatted) String.format( "%s %s %s %s %-2s %-25s %s", - date, time, pid, tid, priority?.priorityChar ?: 'U', LogTagUtils.trimTagIfNeeded(tag, 25), + date, time, pid, tid, level?.levelChar ?: 'U', LogTagUtils.trimTagIfNeeded(tag, 25), message) else unformatted!! } @@ -84,7 +84,7 @@ class LogLine private constructor() : DefaultRecyclable() { if (tid != other.tid) return false if (tag != other.tag) return false if (message != other.message) return false - if (priority != other.priority) return false + if (level != other.level) return false if (formatted != other.formatted) return false return true @@ -98,7 +98,7 @@ class LogLine private constructor() : DefaultRecyclable() { result = 31 * result + (tid?.hashCode() ?: 0) result = 31 * result + (tag?.hashCode() ?: 0) result = 31 * result + (message?.hashCode() ?: 0) - result = 31 * result + (priority?.hashCode() ?: 0) + result = 31 * result + (level?.hashCode() ?: 0) result = 31 * result + formatted.hashCode() return result } @@ -114,10 +114,10 @@ class LogLine private constructor() : DefaultRecyclable() { @JvmOverloads @JvmStatic - fun obtain(priority: ILogger.Priority?, tag: String?, message: String?, + fun obtain(level: ILogger.Level?, tag: String?, message: String?, formatted: Boolean = true): LogLine { val logLine = logLinePool.obtain() - logLine.priority = priority + logLine.level = level logLine.tag = tag logLine.message = message logLine.formatted = formatted @@ -132,7 +132,7 @@ class LogLine private constructor() : DefaultRecyclable() { val logLine = logLinePool.obtain() try { val split = log.split("\\s".toRegex(), limit = 7).toTypedArray() - logLine.priority = ILogger.Priority.forChar(split[4][0]) + logLine.level = ILogger.Level.forChar(split[4][0]) logLine.date = split[0] logLine.time = split[1] // time logLine.pid = split[2] // process id diff --git a/subprojects/jaxp/src/main/java/jaxp/sun/org/apache/xalan/internal/xsltc/compiler/xpath.cup b/subprojects/jaxp/src/main/java/jaxp/sun/org/apache/xalan/internal/xsltc/compiler/xpath.cup index 0bfc82456e..ef41825972 100644 --- a/subprojects/jaxp/src/main/java/jaxp/sun/org/apache/xalan/internal/xsltc/compiler/xpath.cup +++ b/subprojects/jaxp/src/main/java/jaxp/sun/org/apache/xalan/internal/xsltc/compiler/xpath.cup @@ -112,7 +112,7 @@ parser code {: * patterns are expanded as "*[namespace-uri() = 'uri']" and * "@*[namespace-uri() = 'uri']", respectively. This expansion considerably * simplifies the grouping of patterns in the Mode class. For this - * expansion to be correct, the priority of the pattern/template must be + * expansion to be correct, the level of the pattern/template must be * set to -0.25 (when no other predicates are present). */ public StepPattern createStepPattern(int axis, Object test, Vector predicates) { @@ -131,7 +131,7 @@ parser code {: } else { QName name = (QName)test; - boolean setPriority = false; + boolean setLevel = false; if (axis == Axis.NAMESPACE) { nodeType = (name.toString().equals("*")) ? -1 @@ -150,7 +150,7 @@ parser code {: } // Priority is set by hand if no other predicates exist - setPriority = (predicates.size() == 0); + setLevel = (predicates.size() == 0); predicates.add( new Predicate( @@ -174,9 +174,9 @@ parser code {: final StepPattern result = new StepPattern(axis, nodeType, predicates); - // Set priority for case prefix:* and prefix:@* (no predicates) - if (setPriority) { - result.setPriority(-0.25); + // Set level for case prefix:* and prefix:@* (no predicates) + if (setLevel) { + result.setLevel(-0.25); } return result; diff --git a/subprojects/tooling-api-impl/src/main/java/com/itsaky/androidide/tooling/impl/Main.java b/subprojects/tooling-api-impl/src/main/java/com/itsaky/androidide/tooling/impl/Main.java index 3f79a67311..8624d356a3 100644 --- a/subprojects/tooling-api-impl/src/main/java/com/itsaky/androidide/tooling/impl/Main.java +++ b/subprojects/tooling-api-impl/src/main/java/com/itsaky/androidide/tooling/impl/Main.java @@ -19,14 +19,13 @@ import static com.itsaky.androidide.utils.ILogger.newInstance; -import com.itsaky.androidide.models.LogLine; import com.itsaky.androidide.tooling.api.IToolingApiClient; import com.itsaky.androidide.tooling.api.messages.LogMessageParams; import com.itsaky.androidide.tooling.api.util.ToolingApiLauncher; import com.itsaky.androidide.tooling.impl.internal.ProjectImpl; import com.itsaky.androidide.tooling.impl.progress.ForwardingProgressListener; import com.itsaky.androidide.utils.ILogger; -import com.itsaky.androidide.utils.ILogger.Priority; +import com.itsaky.androidide.utils.ILogger.Level; import com.itsaky.androidide.utils.JvmLogger; import java.io.ByteArrayInputStream; import java.nio.charset.StandardCharsets; @@ -125,9 +124,9 @@ public static void finalizeLauncher(ConfigurableLauncher launcher) { } } - private static void onLog(Priority priority, String tag, String message) { + private static void onLog(Level level, String tag, String message) { if (client != null) { - client.logMessage(new LogMessageParams(priority.priorityChar, tag, message)); + client.logMessage(new LogMessageParams(level.levelChar, tag, message)); } } diff --git a/subprojects/tooling-api-impl/src/test/java/com/itsaky/androidide/tooling/impl/MultiModuleAndroidProjectTest.kt b/subprojects/tooling-api-impl/src/test/java/com/itsaky/androidide/tooling/impl/MultiModuleAndroidProjectTest.kt index f38b9e0564..b715050e24 100644 --- a/subprojects/tooling-api-impl/src/test/java/com/itsaky/androidide/tooling/impl/MultiModuleAndroidProjectTest.kt +++ b/subprojects/tooling-api-impl/src/test/java/com/itsaky/androidide/tooling/impl/MultiModuleAndroidProjectTest.kt @@ -44,16 +44,9 @@ import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.JUnit4 import java.nio.file.Paths -import java.nio.file.attribute.PosixFilePermission import java.util.concurrent.CompletableFuture -import kotlin.io.path.ExperimentalPathApi -import kotlin.io.path.createDirectories import kotlin.io.path.createFile import kotlin.io.path.deleteIfExists -import kotlin.io.path.deleteRecursively -import kotlin.io.path.exists -import kotlin.io.path.setPosixFilePermissions -import kotlin.io.path.writeText /** @author Akash Yadav */ @RunWith(JUnit4::class) @@ -363,7 +356,7 @@ class MultiModuleAndroidProjectTest { private val string = StringBuilder() - override fun doLog(priority: Priority?, message: String?) { + override fun doLog(level: Level?, message: String?) { string.append("${message?.trim()}${System.lineSeparator()}") } diff --git a/subprojects/tooling-api/src/main/java/com/itsaky/androidide/tooling/api/messages/LogMessageParams.kt b/subprojects/tooling-api/src/main/java/com/itsaky/androidide/tooling/api/messages/LogMessageParams.kt index 6cfef41933..4015304a29 100644 --- a/subprojects/tooling-api/src/main/java/com/itsaky/androidide/tooling/api/messages/LogMessageParams.kt +++ b/subprojects/tooling-api/src/main/java/com/itsaky/androidide/tooling/api/messages/LogMessageParams.kt @@ -31,5 +31,5 @@ data class LogMessageParams(val level: Char, val tag: String, val message: Strin * Creates a new [LogLine] instance from this [LogMessageParams]. */ fun LogMessageParams.toLogLine(): LogLine { - return LogLine.obtain(ILogger.Priority.forChar(level), tag, message) + return LogLine.obtain(ILogger.Level.forChar(level), tag, message) } diff --git a/testing/lsp/src/main/java/com/itsaky/androidide/lsp/api/util/ReflectiveLogListener.kt b/testing/lsp/src/main/java/com/itsaky/androidide/lsp/api/util/ReflectiveLogListener.kt index b40b3b270d..72099f158b 100644 --- a/testing/lsp/src/main/java/com/itsaky/androidide/lsp/api/util/ReflectiveLogListener.kt +++ b/testing/lsp/src/main/java/com/itsaky/androidide/lsp/api/util/ReflectiveLogListener.kt @@ -17,19 +17,19 @@ package com.itsaky.androidide.lsp.api.util import com.itsaky.androidide.utils.ILogger -import com.itsaky.androidide.utils.ILogger.Priority +import com.itsaky.androidide.utils.ILogger.Level /** @author Akash Yadav */ class ReflectiveLogListener(private val receiver: Class) : ILogger.LogListener { - override fun log(priority: Priority, tag: String, message: String) { + override fun log(level: Level, tag: String, message: String) { val method = receiver.getDeclaredMethod( "log", - Priority::class.java, + Level::class.java, String::class.java, String::class.java ) method.isAccessible = true - method.invoke(null, priority, tag, message) + method.invoke(null, level, tag, message) } } diff --git a/testing/tooling/src/main/java/com/itsaky/androidide/tooling/testing/ToolingApiTestLauncher.kt b/testing/tooling/src/main/java/com/itsaky/androidide/tooling/testing/ToolingApiTestLauncher.kt index af8ba11e77..6f9f2fa3c8 100644 --- a/testing/tooling/src/main/java/com/itsaky/androidide/tooling/testing/ToolingApiTestLauncher.kt +++ b/testing/tooling/src/main/java/com/itsaky/androidide/tooling/testing/ToolingApiTestLauncher.kt @@ -153,7 +153,7 @@ class ToolingApiTestLauncher { override fun logMessage(params: LogMessageParams) { val line = params.toLogLine() - log.log(line.priority, line.formattedTagAndMessage()) + log.log(line.level, line.formattedTagAndMessage()) } override fun logOutput(line: String) {