Skip to content

Commit

Permalink
fix logging on wasm
Browse files Browse the repository at this point in the history
  • Loading branch information
Nek-12 committed Apr 17, 2024
1 parent 61d6c10 commit 3e152df
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
@file:Suppress("TrimMultilineRawString", "UnusedParameter")
@file:Suppress("UnusedParameter")
package pro.respawn.flowmvi.logging

private fun log(message: String): Unit = js("""{ console.log(message); }""")
private fun log(message: String): Unit = js("""console.log(message)""")

private fun info(message: String): Unit = js("""{ console.info(message); }""")
private fun info(message: String): Unit = js("""console.info(message)""")

private fun warn(message: String): Unit = js("""{ console.warn(message); }""")
private fun warn(message: String): Unit = js("""console.warn(message)""")

private fun error(message: String): Unit = js("""{ console.error(message); }""")
private fun error(message: String): Unit = js("""console.error(message)""")

/**
* A [StoreLogger] instance for each supported platform
*/
public actual val PlatformStoreLogger: StoreLogger = StoreLogger { level, tag, message ->
val template = "${if (tag == null) "" else "$tag: "}${message()}()"
val template = "${if (tag == null) "" else "$tag: "}${message()}"
when (level) {
StoreLogLevel.Trace, StoreLogLevel.Debug -> log(template)
StoreLogLevel.Info -> info(template)
Expand Down

0 comments on commit 3e152df

Please sign in to comment.