diff --git a/launcher-gtk/src/main/kotlin/io/gitlab/jfronny/inceptum/gtk/GtkEnvBackend.kt b/launcher-gtk/src/main/kotlin/io/gitlab/jfronny/inceptum/gtk/GtkEnvBackend.kt index 7740590..333680e 100644 --- a/launcher-gtk/src/main/kotlin/io/gitlab/jfronny/inceptum/gtk/GtkEnvBackend.kt +++ b/launcher-gtk/src/main/kotlin/io/gitlab/jfronny/inceptum/gtk/GtkEnvBackend.kt @@ -3,6 +3,7 @@ package io.gitlab.jfronny.inceptum.gtk import io.gitlab.jfronny.commons.StringFormatter import io.gitlab.jfronny.inceptum.common.Utils import io.gitlab.jfronny.inceptum.gtk.util.I18n +import io.gitlab.jfronny.inceptum.gtk.util.Log import io.gitlab.jfronny.inceptum.gtk.window.dialog.MicrosoftLoginDialog import io.gitlab.jfronny.inceptum.gtk.window.dialog.StringInputDialog import io.gitlab.jfronny.inceptum.launcher.LauncherEnv.EnvBackend @@ -16,7 +17,7 @@ object GtkEnvBackend : EnvBackend { var dialogParent: Window? = null override fun showError(message: String, title: String) { - Utils.LOGGER.error(message) + Log.error(message) simpleDialog(message, title, null, null) } @@ -25,12 +26,12 @@ object GtkEnvBackend : EnvBackend { } override fun showInfo(message: String, title: String) { - Utils.LOGGER.info(message) + Log.info(message) simpleDialog(message, title, null, null) } override fun showOkCancel(message: String, title: String, ok: Runnable, cancel: Runnable, defaultCancel: Boolean) { - Utils.LOGGER.info(message) + Log.info(message) simpleDialog(message, title, ok, cancel) } @@ -117,7 +118,7 @@ object GtkEnvBackend : EnvBackend { } ResponseType.DELETE_EVENT -> dialog.destroy() - else -> Utils.LOGGER.error("Unexpected response type: $responseId") + else -> Log.error("Unexpected response type: $responseId") } } } diff --git a/launcher-gtk/src/main/kotlin/io/gitlab/jfronny/inceptum/gtk/GtkMain.kt b/launcher-gtk/src/main/kotlin/io/gitlab/jfronny/inceptum/gtk/GtkMain.kt index 925be2a..24fb435 100644 --- a/launcher-gtk/src/main/kotlin/io/gitlab/jfronny/inceptum/gtk/GtkMain.kt +++ b/launcher-gtk/src/main/kotlin/io/gitlab/jfronny/inceptum/gtk/GtkMain.kt @@ -3,6 +3,7 @@ package io.gitlab.jfronny.inceptum.gtk import io.gitlab.jfronny.inceptum.common.BuildMetadata import io.gitlab.jfronny.inceptum.common.MetaHolder import io.gitlab.jfronny.inceptum.common.Utils +import io.gitlab.jfronny.inceptum.gtk.util.Log import io.gitlab.jfronny.inceptum.gtk.window.MainWindow import io.gitlab.jfronny.inceptum.launcher.LauncherEnv import io.gitlab.jfronny.inceptum.launcher.api.account.AccountManager @@ -19,8 +20,8 @@ object GtkMain { @JvmStatic fun main(args: Array) { LauncherEnv.initialize(GtkEnvBackend) - Utils.LOGGER.info("Launching Inceptum v" + BuildMetadata.VERSION) - Utils.LOGGER.info("Loading from " + MetaHolder.BASE_PATH) + Log.info("Launching Inceptum v" + BuildMetadata.VERSION) + Log.info("Loading from " + MetaHolder.BASE_PATH) exitProcess(try { showGui(args) } catch (_: Throwable) { diff --git a/launcher-gtk/src/main/kotlin/io/gitlab/jfronny/inceptum/gtk/GtkMenubar.kt b/launcher-gtk/src/main/kotlin/io/gitlab/jfronny/inceptum/gtk/GtkMenubar.kt index f7df6df..83db82b 100644 --- a/launcher-gtk/src/main/kotlin/io/gitlab/jfronny/inceptum/gtk/GtkMenubar.kt +++ b/launcher-gtk/src/main/kotlin/io/gitlab/jfronny/inceptum/gtk/GtkMenubar.kt @@ -6,6 +6,7 @@ import io.gitlab.jfronny.inceptum.common.MetaHolder import io.gitlab.jfronny.inceptum.common.Utils import io.gitlab.jfronny.inceptum.gtk.menu.MenuBuilder import io.gitlab.jfronny.inceptum.gtk.util.I18n +import io.gitlab.jfronny.inceptum.gtk.util.Log import io.gitlab.jfronny.inceptum.gtk.window.AboutWindow import io.gitlab.jfronny.inceptum.gtk.window.create.NewInstanceWindow import io.gitlab.jfronny.inceptum.gtk.window.dialog.MicrosoftLoginDialog @@ -155,7 +156,7 @@ object GtkMenubar { } } } catch (e: IOException) { - Utils.LOGGER.error("Could not generate launch menu", e) + Log.error("Could not generate launch menu", e) } } @@ -182,7 +183,7 @@ object GtkMenubar { try { Steps.reDownload(instance, state) } catch (e: IOException) { - Utils.LOGGER.error("Could not fetch instance, trying to start anyways", e) + Log.error("Could not fetch instance, trying to start anyways", e) } if (state.isCancelled) return@show state.updateStep("Starting Game") diff --git a/launcher-gtk/src/main/kotlin/io/gitlab/jfronny/inceptum/gtk/IdleTaskQueue.kt b/launcher-gtk/src/main/kotlin/io/gitlab/jfronny/inceptum/gtk/IdleTaskQueue.kt index 54a8c54..38af799 100644 --- a/launcher-gtk/src/main/kotlin/io/gitlab/jfronny/inceptum/gtk/IdleTaskQueue.kt +++ b/launcher-gtk/src/main/kotlin/io/gitlab/jfronny/inceptum/gtk/IdleTaskQueue.kt @@ -1,6 +1,6 @@ package io.gitlab.jfronny.inceptum.gtk -import io.gitlab.jfronny.inceptum.common.Utils +import io.gitlab.jfronny.inceptum.gtk.util.Log import java.util.* private val SCHEDULED: Queue = ArrayDeque() @@ -15,7 +15,7 @@ fun runScheduledTasks() { try { r!!.run() } catch (t: Throwable) { - Utils.LOGGER.error("Could not run scheduled task", t) + Log.error("Could not run scheduled task", t) } } } \ No newline at end of file diff --git a/launcher-gtk/src/main/kotlin/io/gitlab/jfronny/inceptum/gtk/control/assistant/KAssistant.kt b/launcher-gtk/src/main/kotlin/io/gitlab/jfronny/inceptum/gtk/control/assistant/KAssistant.kt index e4292c6..ba094af 100644 --- a/launcher-gtk/src/main/kotlin/io/gitlab/jfronny/inceptum/gtk/control/assistant/KAssistant.kt +++ b/launcher-gtk/src/main/kotlin/io/gitlab/jfronny/inceptum/gtk/control/assistant/KAssistant.kt @@ -1,6 +1,7 @@ package io.gitlab.jfronny.inceptum.gtk.control.assistant import io.gitlab.jfronny.inceptum.common.Utils +import io.gitlab.jfronny.inceptum.gtk.util.Log import org.gnome.gtk.Application import org.gnome.gtk.Assistant import org.gnome.gtk.AssistantPageType @@ -13,7 +14,7 @@ open class KAssistant(app: Application) : Assistant() { onPrepare { next -> val page = pages.firstOrNull { it.handle() == next.handle() } if (page == null) { - Utils.LOGGER.error("Unknown page opened in assistant") + Log.error("Unknown page opened in assistant") } else { page.emitOpen() } diff --git a/launcher-gtk/src/main/kotlin/io/gitlab/jfronny/inceptum/gtk/control/settings/SettingsWindow.kt b/launcher-gtk/src/main/kotlin/io/gitlab/jfronny/inceptum/gtk/control/settings/SettingsWindow.kt index 3d048f3..833a9e4 100644 --- a/launcher-gtk/src/main/kotlin/io/gitlab/jfronny/inceptum/gtk/control/settings/SettingsWindow.kt +++ b/launcher-gtk/src/main/kotlin/io/gitlab/jfronny/inceptum/gtk/control/settings/SettingsWindow.kt @@ -1,6 +1,8 @@ package io.gitlab.jfronny.inceptum.gtk.control.settings +import io.gitlab.jfronny.inceptum.common.Utils import io.gitlab.jfronny.inceptum.gtk.util.I18n +import io.gitlab.jfronny.inceptum.gtk.util.Log import org.gnome.adw.HeaderBar import org.gnome.adw.ViewStack import org.gnome.adw.ViewSwitcherBar diff --git a/launcher-gtk/src/main/kotlin/io/gitlab/jfronny/inceptum/gtk/menu/MenuBuilder.kt b/launcher-gtk/src/main/kotlin/io/gitlab/jfronny/inceptum/gtk/menu/MenuBuilder.kt index 1b490d5..32a2cc5 100644 --- a/launcher-gtk/src/main/kotlin/io/gitlab/jfronny/inceptum/gtk/menu/MenuBuilder.kt +++ b/launcher-gtk/src/main/kotlin/io/gitlab/jfronny/inceptum/gtk/menu/MenuBuilder.kt @@ -3,6 +3,7 @@ package io.gitlab.jfronny.inceptum.gtk.menu import io.gitlab.jfronny.commons.throwable.ThrowingRunnable import io.gitlab.jfronny.inceptum.common.Utils import io.gitlab.jfronny.inceptum.gtk.util.I18n +import io.gitlab.jfronny.inceptum.gtk.util.Log import org.gnome.gio.* import org.gnome.glib.Variant import org.gnome.glib.VariantType @@ -51,7 +52,7 @@ class MenuBuilder private constructor(map: ActionMap, menu: Menu, prefix: String try { onClick.run() } catch (e: Throwable) { - Utils.LOGGER.error("Could not execute action", e) + Log.error("Could not execute action", e) } } val menuItem = MenuItem(label, groupName + internalName) diff --git a/launcher-gtk/src/main/kotlin/io/gitlab/jfronny/inceptum/gtk/util/Log.kt b/launcher-gtk/src/main/kotlin/io/gitlab/jfronny/inceptum/gtk/util/Log.kt new file mode 100644 index 0000000..841d03f --- /dev/null +++ b/launcher-gtk/src/main/kotlin/io/gitlab/jfronny/inceptum/gtk/util/Log.kt @@ -0,0 +1,6 @@ +package io.gitlab.jfronny.inceptum.gtk.util + +import io.gitlab.jfronny.commons.log.Logger +import io.gitlab.jfronny.inceptum.common.Utils + +object Log : Logger by Utils.LOGGER \ No newline at end of file diff --git a/launcher-gtk/src/main/kotlin/io/gitlab/jfronny/inceptum/gtk/util/Memory.kt b/launcher-gtk/src/main/kotlin/io/gitlab/jfronny/inceptum/gtk/util/Memory.kt index ed0a972..cdf41d2 100644 --- a/launcher-gtk/src/main/kotlin/io/gitlab/jfronny/inceptum/gtk/util/Memory.kt +++ b/launcher-gtk/src/main/kotlin/io/gitlab/jfronny/inceptum/gtk/util/Memory.kt @@ -35,12 +35,12 @@ object Memory { return if (memTotal.isPresent()) { parseDecimalMemorySizeToBinary(memTotal.get()) } else { - Utils.LOGGER.error("Could not find total memory") + Log.error("Could not find total memory") 32 * GB } } } catch (e: IOException) { - Utils.LOGGER.error("Could not get total memory", e) + Log.error("Could not get total memory", e) return 32 * GB } } diff --git a/launcher-gtk/src/main/kotlin/io/gitlab/jfronny/inceptum/gtk/window/MainWindow.kt b/launcher-gtk/src/main/kotlin/io/gitlab/jfronny/inceptum/gtk/window/MainWindow.kt index b1d6f0b..7e4aae7 100644 --- a/launcher-gtk/src/main/kotlin/io/gitlab/jfronny/inceptum/gtk/window/MainWindow.kt +++ b/launcher-gtk/src/main/kotlin/io/gitlab/jfronny/inceptum/gtk/window/MainWindow.kt @@ -112,7 +112,7 @@ class MainWindow(app: Application) : ApplicationWindow(app) { try { setupDirWatcher() } catch (e: IOException) { - Utils.LOGGER.error( + Log.error( "Could not set up watch service, live updates of the instance dir will be unavailable", e ) @@ -126,7 +126,7 @@ class MainWindow(app: Application) : ApplicationWindow(app) { try { if (isw.poll()) generateWindowBody() } catch (e: IOException) { - Utils.LOGGER.error("Could not run update task", e) + Log.error("Could not run update task", e) } GLib.SOURCE_CONTINUE } @@ -160,7 +160,7 @@ class MainWindow(app: Application) : ApplicationWindow(app) { stack.queueResize() stack.queueDraw() } catch (e: IOException) { - Utils.LOGGER.error("Could not generate window body", e) + Log.error("Could not generate window body", e) } } } diff --git a/launcher-gtk/src/main/kotlin/io/gitlab/jfronny/inceptum/gtk/window/create/NewInstanceWindow.kt b/launcher-gtk/src/main/kotlin/io/gitlab/jfronny/inceptum/gtk/window/create/NewInstanceWindow.kt index 4a21d48..92c350f 100644 --- a/launcher-gtk/src/main/kotlin/io/gitlab/jfronny/inceptum/gtk/window/create/NewInstanceWindow.kt +++ b/launcher-gtk/src/main/kotlin/io/gitlab/jfronny/inceptum/gtk/window/create/NewInstanceWindow.kt @@ -10,6 +10,7 @@ import io.gitlab.jfronny.inceptum.gtk.control.KEntry import io.gitlab.jfronny.inceptum.gtk.control.assistant.KAssistant import io.gitlab.jfronny.inceptum.gtk.schedule import io.gitlab.jfronny.inceptum.gtk.util.I18n +import io.gitlab.jfronny.inceptum.gtk.util.Log import io.gitlab.jfronny.inceptum.gtk.util.kText import io.gitlab.jfronny.inceptum.gtk.util.toTypedArray import io.gitlab.jfronny.inceptum.gtk.window.dialog.ProcessStateWatcherDialog @@ -147,7 +148,7 @@ class NewInstanceWindow(app: Application) : KAssistant(app) { try { JFiles.deleteRecursive(MetaHolder.INSTANCE_DIR.resolve(state.name)) } catch (e: IOException) { - Utils.LOGGER.error("Could not delete instance dir", e) + Log.error("Could not delete instance dir", e) } return@Thread } @@ -156,7 +157,7 @@ class NewInstanceWindow(app: Application) : KAssistant(app) { } } catch (e: Throwable) { pState.cancel() - Utils.LOGGER.error("Could not create instance") + Log.error("Could not create instance") failureMessage = StringFormatter.toString(e) isFailure = true } finally { diff --git a/launcher-gtk/src/main/kotlin/io/gitlab/jfronny/inceptum/gtk/window/dialog/MicrosoftLoginDialog.kt b/launcher-gtk/src/main/kotlin/io/gitlab/jfronny/inceptum/gtk/window/dialog/MicrosoftLoginDialog.kt index e4ba9f4..9698324 100644 --- a/launcher-gtk/src/main/kotlin/io/gitlab/jfronny/inceptum/gtk/window/dialog/MicrosoftLoginDialog.kt +++ b/launcher-gtk/src/main/kotlin/io/gitlab/jfronny/inceptum/gtk/window/dialog/MicrosoftLoginDialog.kt @@ -2,6 +2,7 @@ package io.gitlab.jfronny.inceptum.gtk.window.dialog import io.gitlab.jfronny.inceptum.common.Utils import io.gitlab.jfronny.inceptum.gtk.util.I18n +import io.gitlab.jfronny.inceptum.gtk.util.Log import io.gitlab.jfronny.inceptum.launcher.api.account.MicrosoftAccount import io.gitlab.jfronny.inceptum.launcher.api.account.MicrosoftAuthAPI import io.gitlab.jfronny.inceptum.launcher.api.account.MicrosoftAuthServer @@ -28,7 +29,7 @@ class MicrosoftLoginDialog( try { server.start() } catch (e: Exception) { - Utils.LOGGER.error("Could not start mc login server", e) + Log.error("Could not start mc login server", e) } val finalize = Runnable { server.close() @@ -46,7 +47,7 @@ class MicrosoftLoginDialog( destroy() } - else -> Utils.LOGGER.error("Unexpected response type: $responseId") + else -> Log.error("Unexpected response type: $responseId") } } val btn = Button.newWithLabel(I18n["auth.open-browser"]) @@ -55,7 +56,7 @@ class MicrosoftLoginDialog( try { Utils.openWebBrowser(URI(MicrosoftAuthAPI.MICROSOFT_LOGIN_URL)) } catch (e: URISyntaxException) { - Utils.LOGGER.error("Could not open browser", e) + Log.error("Could not open browser", e) } } onCloseRequest { diff --git a/launcher-gtk/src/main/kotlin/io/gitlab/jfronny/inceptum/gtk/window/dialog/ProcessStateWatcherDialog.kt b/launcher-gtk/src/main/kotlin/io/gitlab/jfronny/inceptum/gtk/window/dialog/ProcessStateWatcherDialog.kt index 8943f50..bea2b63 100644 --- a/launcher-gtk/src/main/kotlin/io/gitlab/jfronny/inceptum/gtk/window/dialog/ProcessStateWatcherDialog.kt +++ b/launcher-gtk/src/main/kotlin/io/gitlab/jfronny/inceptum/gtk/window/dialog/ProcessStateWatcherDialog.kt @@ -6,6 +6,7 @@ import io.gitlab.jfronny.inceptum.common.Utils import io.gitlab.jfronny.inceptum.gtk.GtkEnvBackend import io.gitlab.jfronny.inceptum.gtk.schedule import io.gitlab.jfronny.inceptum.gtk.util.I18n +import io.gitlab.jfronny.inceptum.gtk.util.Log import io.gitlab.jfronny.inceptum.launcher.util.ProcessState import org.gnome.glib.GLib import org.gnome.gtk.* @@ -39,7 +40,7 @@ class ProcessStateWatcherDialog( } ResponseType.DELETE_EVENT -> destroy() - else -> Utils.LOGGER.error("Unexpected response type: $responseId") + else -> Log.error("Unexpected response type: $responseId") } } onCloseRequest { @@ -65,7 +66,7 @@ class ProcessStateWatcherDialog( executor.run() } catch (e: Throwable) { state.cancel() - Utils.LOGGER.error(errorMessage, e) + Log.error(errorMessage, e) GtkEnvBackend.simpleDialog( parent, StringFormatter.toString(e), diff --git a/launcher-gtk/src/main/kotlin/io/gitlab/jfronny/inceptum/gtk/window/settings/instance/GeneralTab.kt b/launcher-gtk/src/main/kotlin/io/gitlab/jfronny/inceptum/gtk/window/settings/instance/GeneralTab.kt index d46a6c3..aeecef3 100644 --- a/launcher-gtk/src/main/kotlin/io/gitlab/jfronny/inceptum/gtk/window/settings/instance/GeneralTab.kt +++ b/launcher-gtk/src/main/kotlin/io/gitlab/jfronny/inceptum/gtk/window/settings/instance/GeneralTab.kt @@ -141,7 +141,7 @@ class GeneralTab(window: InstanceSettingsWindow) : SectionedSettingsTab