-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Sergej Shafarenka
committed
Oct 5, 2024
1 parent
dab643a
commit c39c8aa
Showing
15 changed files
with
163 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 5 additions & 14 deletions
19
componental/src/commonMain/kotlin/de/halfbit/componental/Componental.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,12 @@ | ||
package de.halfbit.componental | ||
|
||
public object Componental { | ||
|
||
// logger section api | ||
public enum class LogLevel { DEBUG, ERROR } | ||
public typealias ComponentalLogger = (tag: String, message: String) -> Unit | ||
|
||
public fun setLogger(logger: (LogLevel, String, Throwable?) -> Unit) { | ||
public object Componental { | ||
/** Set to actual logger instance. Noop by default. */ | ||
public fun setLogger(logger: ComponentalLogger) { | ||
log = logger | ||
} | ||
|
||
// logger section implementation | ||
private var log: ((LogLevel, String, Throwable?) -> Unit)? = null | ||
internal fun log(level: LogLevel, message: String, err: Throwable? = null) { | ||
log?.invoke(level, message, err) | ||
} | ||
|
||
internal fun debug(message: String, err: Throwable? = null) { | ||
log?.invoke(LogLevel.DEBUG, message, err) | ||
} | ||
internal var log: ComponentalLogger = { _, _ -> } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.