43 val methodName = line?.substringAfter("#")?.substringBefore("(")
44 val lineNumber = line?.substringAfterLast(".kt:")?.substringBefore(":")
45
46 if (fileName != null && className != null && methodName != null && lineNumber != null) {
47 StackTraceElement(fileName, className, methodName, lineNumber)
48 } else {
49 null
45 line?.substringBefore("\$FUNCTION_REFERENCE")?.substringAfterLast('$')
46 val lineNumber = "1"
47
48 if (fileName != null && className != null && methodName != null && lineNumber != null) {
49 StackTraceElement(fileName, className, methodName, lineNumber)
50 } else {
51 null
18 val message =
19 try {
20 json.encodeToString(json.parseToJsonElement(jsonToPrint))
21 } catch (exception: SerializationException) {
22 jsonToPrint
23 }
24 return buildMokokiMessage(priority, tag, message)
35 val message =
36 try {
37 json.encodeToString(serializer, data)
38 } catch (exception: SerializationException) {
39 data.toString()
40 }
41 return buildMokokiMessage(priority, tag, message)
9 val trace = Thread.currentThread().stackTrace
10 val index = trace.indexOfLast { it.isTestClass }
11 trace[index]
12 } catch (throwable: Throwable) {
13 println("Mokoki has not been able to get the StackTrace")
14 null
15 }
21 val trace = Thread.currentThread().stackTrace
22 val index = trace.indexOfLast { it.isLogFunction }
23 trace[index + 1]
24 } catch (throwable: Throwable) {
25 println("Mokoki has not been able to get the StackTrace")
26 null
27 }
21 val trace = Thread.currentThread().stackTrace
22 val index = trace.indexOfLast { it.isLogFunction }
23 trace[index + 1]
24 } catch (throwable: Throwable) {
25 println("Mokoki has not been able to get the StackTrace")
26 null
27 }
1 @file:Suppress("MagicNumber")
2
3 package com.javiersc.mokoki.core
4
5 import android.os.Bundle
6 import androidx.appcompat.app.AppCompatActivity
1 package com.javiersc.mokoki.jvm.core
2
3 import com.javiersc.mokoki.LoggerSeparator
4 import com.javiersc.mokoki.MokokiLogger
1 @file:Suppress("MagicNumber")
2
3 package com.javiersc.mokoki.jvm.serialization
4
5 import com.javiersc.mokoki.LoggerSeparator
6 import com.javiersc.mokoki.MokokiLogger
6 import kotlin.test.BeforeTest
7 import kotlin.test.Test
8
9 class MokokiMingGWTest {
10
11 private val testLogger = TestMokokiLogger(minPriority = Priority.VERBOSE)
12
1 package com.javiersc.mokoki
2
3 // TODO: test print or native platform logger
4 public actual typealias DefaultMokokiLogger = PrintMokokiLogger
5