Skip to content

Commit 969db15

Browse files
committed
refactor(test): logging
1 parent a407197 commit 969db15

File tree

4 files changed

+15
-0
lines changed

4 files changed

+15
-0
lines changed

build.gradle.kts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,17 @@ dependencies {
6565
implementation("eu.geekplace.javapinning:java-pinning-core:1.2.0")
6666

6767
testImplementation("org.junit.jupiter:junit-jupiter-engine:$jupiterVersion")
68+
testImplementation("org.slf4j:slf4j-simple:$slf4jVersion")
6869

6970
detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:1.23.0")
7071
}
7172

73+
//remove slf4j-nop from test classpath (use slf4j-simple instead)
74+
tasks.withType<Test> {
75+
useJUnitPlatform()
76+
classpath = classpath.filter { !it.toString().contains("slf4j-nop") }
77+
}
78+
7279
configure<app.cash.licensee.LicenseeExtension> {
7380
ignoreDependencies("plus.sourceplus", "protocol")
7481
allow("Apache-2.0")

src/test/kotlin/integration/BatchLiveInstrumentCLI.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ class BatchLiveInstrumentCLI : CLIIntegrationTest() {
4747
addedLiveBps.add(addedLiveBp)
4848
assertNotNull(addedLiveBp.id)
4949
interceptor.clear()
50+
log.info("Added live breakpoint: ${addedLiveBp.id}")
5051
}
5152

5253
//get live bps

src/test/kotlin/integration/CLIIntegrationTest.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ package integration
1919
import io.vertx.core.json.Json
2020
import io.vertx.core.json.JsonArray
2121
import org.junit.jupiter.api.BeforeAll
22+
import org.slf4j.Logger
23+
import org.slf4j.LoggerFactory
2224
import spp.cli.Main
2325
import spp.cli.util.ExitManager
2426
import spp.protocol.instrument.LiveBreakpoint
@@ -40,6 +42,8 @@ open class CLIIntegrationTest {
4042
}
4143
}
4244

45+
val log: Logger by lazy { LoggerFactory.getLogger(this::class.java.name) }
46+
4347
class Interceptor(out: OutputStream) : PrintStream(out, true) {
4448
val output = StringBuilder()
4549

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
org.slf4j.simpleLogger.showDateTime=true
2+
org.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd HH:mm:ss.SS
3+
org.slf4j.simpleLogger.showThreadName=true

0 commit comments

Comments
 (0)