From 8dbb3e52f1c6ea910aa82e383cb3d6e9639452c8 Mon Sep 17 00:00:00 2001 From: John Melati Date: Thu, 17 Oct 2024 01:27:19 +0200 Subject: [PATCH] feat: move logging out of common module --- modules/logging/build.gradle.kts | 30 +++++++++++++++++++ .../com/sphereon/oid/fed/logging/Logging.kt | 26 ++++++++++++++++ .../sphereon/oid/fed/common/logging/Logger.kt | 26 ---------------- settings.gradle.kts | 9 ++++++ 4 files changed, 65 insertions(+), 26 deletions(-) create mode 100644 modules/logging/build.gradle.kts create mode 100644 modules/logging/src/commonMain/kotlin/com/sphereon/oid/fed/logging/Logging.kt delete mode 100644 modules/openid-federation-common/src/commonMain/kotlin/com/sphereon/oid/fed/common/logging/Logger.kt diff --git a/modules/logging/build.gradle.kts b/modules/logging/build.gradle.kts new file mode 100644 index 00000000..fca97ff9 --- /dev/null +++ b/modules/logging/build.gradle.kts @@ -0,0 +1,30 @@ +plugins { + kotlin("multiplatform") version "2.0.0" +} + +group = "com.sphereon.oid.fed" +version = "unspecified" + +repositories { + mavenCentral() +} + +dependencies { +} + +kotlin { + jvm() + + js(IR) { + browser() + nodejs() + } + + sourceSets { + commonMain { + dependencies { + implementation(libs.kermit.logging) + } + } + } +} \ No newline at end of file diff --git a/modules/logging/src/commonMain/kotlin/com/sphereon/oid/fed/logging/Logging.kt b/modules/logging/src/commonMain/kotlin/com/sphereon/oid/fed/logging/Logging.kt new file mode 100644 index 00000000..a32e5be9 --- /dev/null +++ b/modules/logging/src/commonMain/kotlin/com/sphereon/oid/fed/logging/Logging.kt @@ -0,0 +1,26 @@ +package com.sphereon.oid.fed.common.logging + +import co.touchlab.kermit.Logger as KermitLogger + +object Logger { + + fun verbose(tag: String, message: String) { + KermitLogger.v(tag = tag, messageString = message) + } + + fun debug(tag: String, message: String) { + KermitLogger.d(tag = tag, messageString = message) + } + + fun info(tag: String, message: String) { + KermitLogger.i(tag = tag, messageString = message) + } + + fun warn(tag: String, message: String) { + KermitLogger.w(tag = tag, messageString = message) + } + + fun error(tag: String, message: String, throwable: Throwable? = null) { + KermitLogger.e(tag = tag, messageString = message, throwable = throwable) + } +} diff --git a/modules/openid-federation-common/src/commonMain/kotlin/com/sphereon/oid/fed/common/logging/Logger.kt b/modules/openid-federation-common/src/commonMain/kotlin/com/sphereon/oid/fed/common/logging/Logger.kt deleted file mode 100644 index a9669633..00000000 --- a/modules/openid-federation-common/src/commonMain/kotlin/com/sphereon/oid/fed/common/logging/Logger.kt +++ /dev/null @@ -1,26 +0,0 @@ -package com.sphereon.oid.fed.common.logging - -import co.touchlab.kermit.Logger - -object Logger { - - fun verbose(tag: String, message: String) { - Logger.v(tag = tag, messageString = message) - } - - fun debug(tag: String, message: String) { - Logger.d(tag = tag, messageString = message) - } - - fun info(tag: String, message: String) { - Logger.i(tag = tag, messageString = message) - } - - fun warn(tag: String, message: String) { - Logger.w(tag = tag, messageString = message) - } - - fun error(tag: String, message: String, throwable: Throwable? = null) { - Logger.e(tag = tag, messageString = message, throwable = throwable) - } -} \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts index 90d48f4c..3e562509 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -21,6 +21,9 @@ pluginManagement { gradlePluginPortal() } } +plugins { + id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0" +} dependencyResolutionManagement { repositories { @@ -49,3 +52,9 @@ include(":modules:openapi") include(":modules:persistence") include(":modules:services") include("modules:local-kms") +include("modules:logging") +findProject(":modules:logging")?.name = "logging" +include("modules:logging") +findProject(":modules:logging")?.name = "logging" +include("modules:logging") +findProject(":modules:logging")?.name = "logging"