Skip to content

Commit a958f24

Browse files
committed
Merge remote-tracking branch 'origin/master' into dev
# Conflicts: # README.md
2 parents cd7d1d2 + 353d288 commit a958f24

File tree

3 files changed

+24
-10
lines changed

3 files changed

+24
-10
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Kotlin Spotify Web API
22
[ ![JCenter Download](https://api.bintray.com/packages/bintray/jcenter/com.adamratzman%3Aspotify-api-kotlin/images/download.svg) ](https://bintray.com/bintray/jcenter/com.adamratzman%3Aspotify-api-kotlin/_latestVersion)
3-
[![](https://img.shields.io/badge/Wiki-Docs-red.svg)](https://adamint.github.io/spotify-web-api-kotlin/-spotify-kotlin-wrapper/)
4-
[![Build status](http://144.217.240.243:8111/app/rest/builds/aggregated/strob:(buildType:(project:(id:SpotifyWebApiKotlin)))/statusIcon.svg)](http://144.217.240.243:8111/viewType.html?buildTypeId=SpotifyWebApiKotlin)
3+
[![Build Status](http://144.217.240.243:8111/app/rest/builds/aggregated/strob:(buildType:(project:(id:SpotifyWebApiKotlin)))/statusIcon.svg)](http://144.217.240.243:8111/project.html?projectId=SpotifyWebApiKotlin)
4+
[![](https://img.shields.io/badge/Documentation-latest-orange.svg)](https://adamint.github.io/spotify-web-api-kotlin/docs/spotify-web-api-kotlin/)
55
![](https://img.shields.io/badge/License-MIT-blue.svg)
66

77
This is the [Kotlin](https://kotlinlang.org/) implementation of the [Spotify Web API](https://developer.spotify.com/web-api/)

src/jsMain/kotlin/com/adamratzman/spotify/SpotifyLogger.kt

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,16 @@ actual class SpotifyLogger actual constructor(actual var enabled: Boolean) {
1313
actual fun logError(fatal: Boolean, message: String?, throwable: Throwable?) {
1414
if (!enabled) return
1515

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)
2027
}
2128
}

src/jvmMain/kotlin/com/adamratzman/spotify/SpotifyLogger.kt

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,17 @@ actual class SpotifyLogger actual constructor(actual var enabled: Boolean) {
1717
actual fun logError(fatal: Boolean, message: String?, throwable: Throwable?) {
1818
if (!enabled) return
1919

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)
2431
throwable?.printStackTrace()
2532
}
2633
}

0 commit comments

Comments
 (0)