Skip to content

Commit 16b38a0

Browse files
perf(core): slim down per-mutant debug log message
Logging the whole MutantWithId case class stringified the entire mutated tree; log only the useful fields instead
1 parent b7e3278 commit 16b38a0

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

modules/core/src/main/scala/stryker4s/run/MutantRunner.scala

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,12 @@ class MutantRunner(
201201
.emits(testableMutants)
202202
.through(testRunnerPool.run { case (testRunner, (path, mutant)) =>
203203
val coverageForMutant = coverageExclusions.coveredMutants.getOrElse(mutant.id, Seq.empty)
204-
IO(log.debug(s"Running mutant $mutant")) *>
204+
IO(
205+
log.debug {
206+
val metadata = mutant.mutatedCode.metadata
207+
s"Running mutant ${mutant.id.value} (${metadata.mutatorName} at ${metadata.location.show})"
208+
}
209+
) *>
205210
testRunner.runMutant(mutant, coverageForMutant).timed.flatMap { case (duration, result) =>
206211
IO(log.debug(s"Mutant ${mutant.id} tested in ${duration.toHumanReadable}")).as(path -> result)
207212
}

modules/core/src/test/scala/stryker4s/run/MutantRunnerTest.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,11 @@ class MutantRunnerTest extends Stryker4sIOSuite with LogMatchers with TestData {
194194
val mutants = NonEmptyVector.one(mutant)
195195
val mutatedFile = MutatedFile(file, "def foo = 4".parseDef, mutants)
196196

197+
val metadata = mutant.mutatedCode.metadata
197198
sut(Vector(mutatedFile))
198-
.assertLoggedDebug(s"Running mutant $mutant")
199+
.assertLoggedDebug(
200+
s"Running mutant ${mutant.id.value} (${metadata.mutatorName} at ${metadata.location.show})"
201+
)
199202
.assertLoggedDebug("Mutant 1 tested in")
200203
}
201204

0 commit comments

Comments
 (0)