Skip to content

Commit 1fee5c7

Browse files
committed
chore: improve various logging statements
1 parent cd0324e commit 1fee5c7

File tree

5 files changed

+10
-8
lines changed

5 files changed

+10
-8
lines changed

gradle/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ tasks {
6767
val release by creating {
6868
dependsOn(clean, check)
6969
group = "distribution"
70-
description = "Prepares a new Release by bumping the version and creating a commit with a git tag for the new version"
70+
description = "Prepares a new Release by bumping the version and creating and pushing a commit tagged with the new version"
7171
doLast {
7272
var newVersion = version
7373
fun String.editVersion(version: String, new: Int) =

plugin/src/main/kotlin/sc/plugin2022/Game.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,10 @@ class Game(override val currentState: GameState = GameState()): AbstractGame(Gam
116116
}
117117
player.hasLeft() -> {
118118
cause = ScoreCause.LEFT
119-
reason = "Der Spieler hat das Spiel verlassen"
119+
reason = "Der Spieler hat das Spiel verlassen: ${player.left}"
120120
}
121121
}
122-
return PlayerScore(cause,
123-
reason,
124-
score,
122+
return PlayerScore(cause, reason, score,
125123
currentState.getPointsForTeam(team),
126124
currentState.board.filterValues { it.team == team && it.type.isLight }
127125
.maxOf { it.key.lightScore(team) }

sdk/src/main/server-api/sc/framework/plugins/AbstractGame.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ abstract class AbstractGame(override val pluginUUID: String) : IGameInstance, Pa
2929

3030
override val winner: ITeam?
3131
get() = players.singleOrNull { !it.hasViolated() && !it.hasLeft() }?.team ?:
32-
checkWinCondition()?.also { logger.trace("No Winner via violation, WinCondition: {}", it) }?.winner
32+
checkWinCondition()?.also { logger.debug("No Winner via violation, WinCondition: {}", it) }?.winner
3333

3434
/** Pause the game after current turn has finished or continue playing. */
3535
override var isPaused = false

sdk/src/main/server-api/sc/networking/clients/XStreamClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public void sendCustomData(String data) throws IOException {
160160
}
161161

162162
public void sendCustomData(byte[] data) throws IOException {
163-
logger.info("Sending custom data (size={})", data.length);
163+
logger.info("Sending custom data ({} bytes)", data.length);
164164
networkInterface.getOutputStream().write(data);
165165
networkInterface.getOutputStream().flush();
166166
}

server/src/test/java/sc/server/network/LobbyTest.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package sc.server.network
22

3+
import io.kotest.assertions.withClue
34
import io.kotest.matchers.shouldBe
45
import org.junit.jupiter.api.Test
56
import sc.api.plugins.Team
@@ -50,7 +51,10 @@ class LobbyTest: RealServerTest() {
5051

5152
await("Game is over") { room.isOver }
5253
await("Receive GameResult") { room.result != null }
53-
room.result.scores.filterKeys { it.team == Team.ONE }.values.single().cause shouldBe ScoreCause.LEFT
54+
withClue("Irregular GameResult") {
55+
room.result.isRegular shouldBe false
56+
room.result.scores.filterKeys { it.team == Team.ONE }.values.single().cause shouldBe ScoreCause.LEFT
57+
}
5458

5559
await("GameRoom closes") { gameMgr.games.isEmpty() }
5660
}

0 commit comments

Comments
 (0)