Skip to content

Commit a4b60c1

Browse files
committed
fix compilation
1 parent c824e5b commit a4b60c1

4 files changed

Lines changed: 28 additions & 14 deletions

File tree

src/darwinMain/kotlin/io/github/oshai/kotlinlogging/KotlinLoggingConfiguration.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
package io.github.oshai.kotlinlogging
22

33
import kotlin.concurrent.AtomicReference
4-
import platform.posix.getenv
5-
import kotlinx.cinterop.toKString
64
import kotlinx.cinterop.ExperimentalForeignApi
5+
import kotlinx.cinterop.toKString
6+
import platform.posix.getenv
77

88
@OptIn(ExperimentalForeignApi::class)
99
private fun getEnv(name: String): String? {
1010
return getenv(name)?.toKString()
1111
}
1212

13-
1413
public actual object KotlinLoggingConfiguration {
1514
// Existing Darwin-specific properties
1615
public var subsystem: AtomicReference<String?> = AtomicReference(null)
1716
public var category: AtomicReference<String?> = AtomicReference(null)
1817

19-
private val _logStartupMessage = AtomicReference(getEnv("KOTLIN_LOGGING_STARTUP_MESSAGE")?.toBoolean() ?: true)
18+
private val _logStartupMessage =
19+
AtomicReference(getEnv("KOTLIN_LOGGING_STARTUP_MESSAGE")?.toBoolean() ?: true)
2020
public actual var logStartupMessage: Boolean
2121
get() = _logStartupMessage.value
2222
set(value) {

src/jsMain/kotlin/io/github/oshai/kotlinlogging/KotlinLoggingConfiguration.kt

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,24 @@ package io.github.oshai.kotlinlogging
22

33
private fun resolveStartupMessageDefault(): Boolean {
44
try {
5-
val disabledInWindow = js("typeof window !== 'undefined' && (window.KOTLIN_LOGGING_STARTUP_MESSAGE === 'false' || window.KOTLIN_LOGGING_STARTUP_MESSAGE === false)") as Boolean
5+
val disabledInWindow =
6+
js(
7+
"typeof window !== 'undefined' && (window.KOTLIN_LOGGING_STARTUP_MESSAGE === 'false' || window.KOTLIN_LOGGING_STARTUP_MESSAGE === false)"
8+
)
9+
as Boolean
610
if (disabledInWindow) {
711
return false
812
}
9-
10-
val disabledInEnv = js("typeof process !== 'undefined' && process.env && (process.env.KOTLIN_LOGGING_STARTUP_MESSAGE === 'false' || process.env.KOTLIN_LOGGING_STARTUP_MESSAGE === false)") as Boolean
13+
14+
val disabledInEnv =
15+
js(
16+
"typeof process !== 'undefined' && process.env && (process.env.KOTLIN_LOGGING_STARTUP_MESSAGE === 'false' || process.env.KOTLIN_LOGGING_STARTUP_MESSAGE === false)"
17+
)
18+
as Boolean
1119
if (disabledInEnv) {
1220
return false
1321
}
14-
22+
1523
return true
1624
} catch (e: Throwable) {
1725
return true

src/nativeMain/kotlin/io/github/oshai/kotlinlogging/KotlinLoggingConfiguration.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
package io.github.oshai.kotlinlogging
22

33
import kotlin.concurrent.AtomicReference
4-
import platform.posix.getenv
5-
import kotlinx.cinterop.toKString
64
import kotlinx.cinterop.ExperimentalForeignApi
5+
import kotlinx.cinterop.toKString
6+
import platform.posix.getenv
77

88
@OptIn(ExperimentalForeignApi::class)
99
private fun getEnv(name: String): String? {
1010
return getenv(name)?.toKString()
1111
}
1212

13-
1413
public actual object KotlinLoggingConfiguration {
1514
public actual val direct: DirectLoggingConfiguration =
1615
object : DirectLoggingConfiguration {
@@ -40,7 +39,8 @@ public actual object KotlinLoggingConfiguration {
4039
}
4140
}
4241

43-
private val _logStartupMessage = AtomicReference(getEnv("KOTLIN_LOGGING_STARTUP_MESSAGE")?.toBoolean() ?: true)
42+
private val _logStartupMessage =
43+
AtomicReference(getEnv("KOTLIN_LOGGING_STARTUP_MESSAGE")?.toBoolean() ?: true)
4444
public actual var logStartupMessage: Boolean
4545
get() = _logStartupMessage.value
4646
set(value) {

src/wasmJsMain/kotlin/io/github/oshai/kotlinlogging/KotlinLoggingConfiguration.kt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
package io.github.oshai.kotlinlogging
22

33
private val startupMessageDisabledInWindow: Boolean =
4-
js("typeof window !== 'undefined' && (window.KOTLIN_LOGGING_STARTUP_MESSAGE === 'false' || window.KOTLIN_LOGGING_STARTUP_MESSAGE === false)") as Boolean
4+
js(
5+
"typeof window !== 'undefined' && (window.KOTLIN_LOGGING_STARTUP_MESSAGE === 'false' || window.KOTLIN_LOGGING_STARTUP_MESSAGE === false)"
6+
)
7+
as Boolean
58

69
private val startupMessageDisabledInEnv: Boolean =
7-
js("typeof process !== 'undefined' && process.env && (process.env.KOTLIN_LOGGING_STARTUP_MESSAGE === 'false' || process.env.KOTLIN_LOGGING_STARTUP_MESSAGE === false)") as Boolean
10+
js(
11+
"typeof process !== 'undefined' && process.env && (process.env.KOTLIN_LOGGING_STARTUP_MESSAGE === 'false' || process.env.KOTLIN_LOGGING_STARTUP_MESSAGE === false)"
12+
)
13+
as Boolean
814

915
private fun resolveStartupMessageDefault(): Boolean {
1016
try {

0 commit comments

Comments
 (0)