File tree Expand file tree Collapse file tree
darwinMain/kotlin/io/github/oshai/kotlinlogging
jsMain/kotlin/io/github/oshai/kotlinlogging
nativeMain/kotlin/io/github/oshai/kotlinlogging
wasmJsMain/kotlin/io/github/oshai/kotlinlogging Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package io.github.oshai.kotlinlogging
22
33import kotlin.concurrent.AtomicReference
4- import platform.posix.getenv
5- import kotlinx.cinterop.toKString
64import kotlinx.cinterop.ExperimentalForeignApi
5+ import kotlinx.cinterop.toKString
6+ import platform.posix.getenv
77
88@OptIn(ExperimentalForeignApi ::class )
99private fun getEnv (name : String ): String? {
1010 return getenv(name)?.toKString()
1111}
1212
13-
1413public 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) {
Original file line number Diff line number Diff line change @@ -2,16 +2,24 @@ package io.github.oshai.kotlinlogging
22
33private 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
Original file line number Diff line number Diff line change 11package io.github.oshai.kotlinlogging
22
33import kotlin.concurrent.AtomicReference
4- import platform.posix.getenv
5- import kotlinx.cinterop.toKString
64import kotlinx.cinterop.ExperimentalForeignApi
5+ import kotlinx.cinterop.toKString
6+ import platform.posix.getenv
77
88@OptIn(ExperimentalForeignApi ::class )
99private fun getEnv (name : String ): String? {
1010 return getenv(name)?.toKString()
1111}
1212
13-
1413public 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) {
Original file line number Diff line number Diff line change 11package io.github.oshai.kotlinlogging
22
33private 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
69private 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
915private fun resolveStartupMessageDefault (): Boolean {
1016 try {
You can’t perform that action at this time.
0 commit comments