File tree Expand file tree Collapse file tree 2 files changed +22
-8
lines changed
jsMain/kotlin/com/adamratzman/spotify
jvmMain/kotlin/com/adamratzman/spotify Expand file tree Collapse file tree 2 files changed +22
-8
lines changed Original file line number Diff line number Diff line change @@ -13,9 +13,16 @@ actual class SpotifyLogger actual constructor(actual var enabled: Boolean) {
13
13
actual fun logError (fatal : Boolean , message : String? , throwable : Throwable ? ) {
14
14
if (! enabled) return
15
15
16
- val sb = StringBuilder (" Spotify Logger " )
17
- sb.append(if (fatal) " FATAL" else " Error" )
18
- if (message != null ) sb.append(" : $message " )
19
- sb.append(" \n $throwable " )
16
+ val error = StringBuilder (" Spotify Logger " ).apply {
17
+ if (fatal) append(" FATAL" )
18
+ else append(" Error" )
19
+ if (message != null ) {
20
+ append(" : " )
21
+ append(message)
22
+ }
23
+ append(" \n " )
24
+ append(throwable)
25
+ }.toString()
26
+ console.error(error)
20
27
}
21
28
}
Original file line number Diff line number Diff line change @@ -17,10 +17,17 @@ actual class SpotifyLogger actual constructor(actual var enabled: Boolean) {
17
17
actual fun logError (fatal : Boolean , message : String? , throwable : Throwable ? ) {
18
18
if (! enabled) return
19
19
20
- val sb = StringBuilder (" ${redString} Spotify Logger " )
21
- sb.append(if (fatal) " FATAL" else " Error" )
22
- if (message != null ) sb.append(" : $message " )
23
- sb.append(resetString)
20
+ val error = StringBuilder (redString).apply {
21
+ append(" Spotify Logger " )
22
+ if (fatal) append(" FATAL" )
23
+ else append(" Error" )
24
+ if (message != null ) {
25
+ append(" : " )
26
+ append(message)
27
+ }
28
+ append(resetString)
29
+ }.toString()
30
+ System .err.println (error)
24
31
throwable?.printStackTrace()
25
32
}
26
33
}
You can’t perform that action at this time.
0 commit comments