diff --git a/course-management.conf b/course-management.conf
index cd4ff6cfa..c1d2bc839 100644
--- a/course-management.conf
+++ b/course-management.conf
@@ -5,6 +5,9 @@ cmt {
# Folder in studentified repo holding the current exercise code
studentified-repo-active-exercise-folder = .
+ # Folder in linearized repo holding the current exercise code
+ linearized-repo-active-exercise-folder = code
+
# List of folders containing test code
test-code-folders = [
"src/test"
diff --git a/exercises/exercise_000_sudoku_solver_initial_state/build.sbt b/exercises/exercise_000_sudoku_solver_initial_state/build.sbt
index 24aa5a89a..86b055056 100644
--- a/exercises/exercise_000_sudoku_solver_initial_state/build.sbt
+++ b/exercises/exercise_000_sudoku_solver_initial_state/build.sbt
@@ -1,13 +1,10 @@
-
Global / onChangedBuildSource := ReloadOnSourceChanges
-
lazy val `moving-from-scala-2-to-scala-3` =
(project in file(".")).settings(
scalaVersion := "2.13.10",
Compile / scalacOptions ++= CompileOptions.compileOptions,
libraryDependencies ++= Dependencies.dependencies,
- testFrameworks += new TestFramework("munit.Framework"),
- )
+ testFrameworks += new TestFramework("munit.Framework"))
sbt.addCommandAlias("runSolver", "runMain org.lunatechlabs.dotty.SudokuSolverMain")
diff --git a/exercises/exercise_000_sudoku_solver_initial_state/project/Build.scala b/exercises/exercise_000_sudoku_solver_initial_state/project/Build.scala
index 85eea50b0..ee2789094 100644
--- a/exercises/exercise_000_sudoku_solver_initial_state/project/Build.scala
+++ b/exercises/exercise_000_sudoku_solver_initial_state/project/Build.scala
@@ -7,42 +7,31 @@ object CompileOptions {
lazy val rewriteNoIndent = Seq("-rewrite", "-noindent")
lazy val rewriteOldSyntax = Seq("-rewrite", "-old-syntax")
- lazy val compileOptions = Seq(
- "-unchecked",
- "-deprecation",
- "-encoding", "UTF-8",
- )
+ lazy val compileOptions = Seq("-unchecked", "-deprecation", "-encoding", "UTF-8")
}
object Versions {
- lazy val akkaVer = "2.6.20"
- lazy val logbackVer = "1.2.3"
- lazy val mUnitVer = "0.7.26"
+ lazy val akkaVer = "2.6.20"
+ lazy val logbackVer = "1.2.3"
+ lazy val mUnitVer = "0.7.26"
}
object Dependencies {
private lazy val akkaDeps = Seq(
- "com.typesafe.akka" %% "akka-actor-typed",
- "com.typesafe.akka" %% "akka-slf4j",
- "com.typesafe.akka" %% "akka-stream",
- ).map (_ % Versions.akkaVer)
+ "com.typesafe.akka" %% "akka-actor-typed",
+ "com.typesafe.akka" %% "akka-slf4j",
+ "com.typesafe.akka" %% "akka-stream").map(_ % Versions.akkaVer)
- private lazy val akkaTestkitDeps = Seq(
- "com.typesafe.akka" %% "akka-actor-testkit-typed" % Versions.akkaVer % Test
- )
+ private lazy val akkaTestkitDeps = Seq("com.typesafe.akka" %% "akka-actor-testkit-typed" % Versions.akkaVer % Test)
- private lazy val logbackDeps = Seq (
- "ch.qos.logback" % "logback-classic",
- ).map (_ % Versions.logbackVer)
+ private lazy val logbackDeps = Seq("ch.qos.logback" % "logback-classic").map(_ % Versions.logbackVer)
- private lazy val munitDeps = Seq(
- "org.scalameta" %% "munit" % Versions.mUnitVer % Test
- )
+ private lazy val munitDeps = Seq("org.scalameta" %% "munit" % Versions.mUnitVer % Test)
lazy val dependencies: Seq[ModuleID] =
logbackDeps ++
- munitDeps ++
- akkaDeps ++
- akkaTestkitDeps
+ munitDeps ++
+ akkaDeps ++
+ akkaTestkitDeps
}
diff --git a/exercises/exercise_000_sudoku_solver_initial_state/project/build.properties b/exercises/exercise_000_sudoku_solver_initial_state/project/build.properties
index 72413de15..52413ab79 100644
--- a/exercises/exercise_000_sudoku_solver_initial_state/project/build.properties
+++ b/exercises/exercise_000_sudoku_solver_initial_state/project/build.properties
@@ -1 +1 @@
-sbt.version=1.8.3
+sbt.version=1.9.3
diff --git a/exercises/exercise_000_sudoku_solver_initial_state/src/main/resources/application.conf b/exercises/exercise_000_sudoku_solver_initial_state/src/main/resources/application.conf
index 14927baad..0b5d34e99 100644
--- a/exercises/exercise_000_sudoku_solver_initial_state/src/main/resources/application.conf
+++ b/exercises/exercise_000_sudoku_solver_initial_state/src/main/resources/application.conf
@@ -1,4 +1,8 @@
akka {
+ loggers = ["akka.event.slf4j.Slf4jLogger"]
+ loglevel = "INFO"
+ logging-filter = "akka.event.slf4j.Slf4jLoggingFilter"
+
log-dead-letters = on
logger-startup-timeout = 30s
diff --git a/exercises/exercise_000_sudoku_solver_initial_state/src/main/resources/logback.xml b/exercises/exercise_000_sudoku_solver_initial_state/src/main/resources/logback.xml
index 16cdaa5de..e28eccd9b 100644
--- a/exercises/exercise_000_sudoku_solver_initial_state/src/main/resources/logback.xml
+++ b/exercises/exercise_000_sudoku_solver_initial_state/src/main/resources/logback.xml
@@ -1,24 +1,24 @@
+
-
+
- info
+ INFO
- %date{HH:mm:ss} %-5level [%X{akkaSource}] - %msg%n
+ [%date{ISO8601}] [%level] [%logger] [%marker] [%thread] - %msg %n
-
-
-
-
-
-
-
+
+ target/sudoku.log
+
+ [%date{ISO8601}] [%level] [%logger] [%marker] [%thread] - %msg %n
+
+
-
-
+
+
+
-
diff --git a/exercises/exercise_000_sudoku_solver_initial_state/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuProgressTracker.scala b/exercises/exercise_000_sudoku_solver_initial_state/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuProgressTracker.scala
index e09f75846..ddddebc51 100644
--- a/exercises/exercise_000_sudoku_solver_initial_state/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuProgressTracker.scala
+++ b/exercises/exercise_000_sudoku_solver_initial_state/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuProgressTracker.scala
@@ -30,11 +30,13 @@ class SudokuProgressTracker private (
def trackProgress(updatesInFlight: Int): Behavior[Command] =
Behaviors.receiveMessage {
case NewUpdatesInFlight(updateCount) if updatesInFlight - 1 == 0 =>
+ context.log.debug("NewUpdatesInFlight({}) - UpdatesInFlight={}", updateCount, updatesInFlight + updateCount)
rowDetailProcessors.foreach { case (_, processor) =>
processor ! SudokuDetailProcessor.GetSudokuDetailState(context.self)
}
collectEndState()
case NewUpdatesInFlight(updateCount) =>
+ context.log.debug("NewUpdatesInFlight({}) - UpdatesInFlight={}", updateCount, updatesInFlight + updateCount)
trackProgress(updatesInFlight + updateCount)
case msg: SudokuDetailState =>
context.log.error("Received unexpected message in state 'trackProgress': {}", msg)
diff --git a/exercises/exercise_000_sudoku_solver_initial_state/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuSolver.scala b/exercises/exercise_000_sudoku_solver_initial_state/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuSolver.scala
index 5e14e96b5..bb4e5f503 100644
--- a/exercises/exercise_000_sudoku_solver_initial_state/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuSolver.scala
+++ b/exercises/exercise_000_sudoku_solver_initial_state/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuSolver.scala
@@ -74,6 +74,7 @@ class SudokuSolver private (context: ActorContext[SudokuSolver.Command], buffer:
rowUpdates.foreach { case SudokuDetailProcessor.RowUpdate(row, cellUpdates) =>
rowDetailProcessors(row) ! SudokuDetailProcessor.Update(cellUpdates, detailProcessorResponseMapper)
}
+ context.log.debug("InitialRowUpdates: {}", rowUpdates)
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(rowUpdates.size)
processRequest(Some(sender), System.currentTimeMillis())
case unexpectedMsg =>
@@ -88,38 +89,79 @@ class SudokuSolver private (context: ActorContext[SudokuSolver.Command], buffer:
response match {
case SudokuDetailProcessor.RowUpdate(rowNr, updates) =>
updates.foreach { case (rowCellNr, newCellContent) =>
+ context.log.debug("Incoming update for Row({},{})={} ", rowNr, rowCellNr, newCellContent)
val (columnNr, columnCellNr) = rowToColumnCoordinates(rowNr, rowCellNr)
val columnUpdate = Vector(columnCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from RowProcessor({}) for Column({}, {})={} ",
+ rowNr,
+ columnNr,
+ columnCellNr,
+ columnUpdate)
columnDetailProcessors(columnNr) ! SudokuDetailProcessor.Update(
columnUpdate,
detailProcessorResponseMapper)
val (blockNr, blockCellNr) = rowToBlockCoordinates(rowNr, rowCellNr)
val blockUpdate = Vector(blockCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from RowProcessor({}) for Block({}, {})={} ",
+ rowNr,
+ blockNr,
+ blockCellNr,
+ blockUpdate)
blockDetailProcessors(blockNr) ! SudokuDetailProcessor.Update(blockUpdate, detailProcessorResponseMapper)
}
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(2 * updates.size - 1)
Behaviors.same
case SudokuDetailProcessor.ColumnUpdate(columnNr, updates) =>
updates.foreach { case (colCellNr, newCellContent) =>
+ context.log.debug("Incoming update for Column({},{})={} ", columnNr, colCellNr, newCellContent)
val (rowNr, rowCellNr) = columnToRowCoordinates(columnNr, colCellNr)
val rowUpdate = Vector(rowCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from ColumnProcessor({}) for Row({}, {})={} ",
+ columnNr,
+ rowNr,
+ rowCellNr,
+ rowUpdate)
rowDetailProcessors(rowNr) ! SudokuDetailProcessor.Update(rowUpdate, detailProcessorResponseMapper)
val (blockNr, blockCellNr) = columnToBlockCoordinates(columnNr, colCellNr)
val blockUpdate = Vector(blockCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from ColumnProcessor({}) for Block({}, {})={} ",
+ columnNr,
+ blockNr,
+ blockCellNr,
+ blockUpdate)
blockDetailProcessors(blockNr) ! SudokuDetailProcessor.Update(blockUpdate, detailProcessorResponseMapper)
}
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(2 * updates.size - 1)
Behaviors.same
case SudokuDetailProcessor.BlockUpdate(blockNr, updates) =>
updates.foreach { case (blockCellNr, newCellContent) =>
+ context.log.debug("Incoming update for Block({},{})={} ", blockNr, blockCellNr, newCellContent)
val (rowNr, rowCellNr) = blockToRowCoordinates(blockNr, blockCellNr)
val rowUpdate = Vector(rowCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from BlockProcessor({}) for Row({}, {})={} ",
+ blockNr,
+ rowNr,
+ rowCellNr,
+ rowUpdate)
+
rowDetailProcessors(rowNr) ! SudokuDetailProcessor.Update(rowUpdate, detailProcessorResponseMapper)
val (columnNr, columnCellNr) = blockToColumnCoordinates(blockNr, blockCellNr)
val columnUpdate = Vector(columnCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from BlockProcessor({}) for Column({}, {})={} ",
+ blockNr,
+ columnNr,
+ columnCellNr,
+ columnUpdate)
+
columnDetailProcessors(columnNr) ! SudokuDetailProcessor.Update(
columnUpdate,
detailProcessorResponseMapper)
@@ -127,6 +169,7 @@ class SudokuSolver private (context: ActorContext[SudokuSolver.Command], buffer:
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(2 * updates.size - 1)
Behaviors.same
case unchanged @ SudokuDetailProcessor.SudokuDetailUnchanged =>
+ context.log.debug("SudokuDetailUnchanged")
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(-1)
Behaviors.same
}
@@ -134,6 +177,7 @@ class SudokuSolver private (context: ActorContext[SudokuSolver.Command], buffer:
result match {
case SudokuProgressTracker.Result(sudoku) =>
context.log.info(s"Sudoku processing time: ${System.currentTimeMillis() - startTime} milliseconds")
+ context.log.debug("Result: {}", sudoku)
requestor.get ! SudokuSolution(sudoku)
resetAllDetailProcessors()
buffer.unstashAll(idle())
diff --git a/exercises/exercise_001_dotty_deprecated_syntax_rewriting/build.sbt b/exercises/exercise_001_dotty_deprecated_syntax_rewriting/build.sbt
index 7dc71f9bc..d104338c1 100644
--- a/exercises/exercise_001_dotty_deprecated_syntax_rewriting/build.sbt
+++ b/exercises/exercise_001_dotty_deprecated_syntax_rewriting/build.sbt
@@ -1,12 +1,10 @@
Global / onChangedBuildSource := ReloadOnSourceChanges
-
lazy val `moving-from-scala-2-to-scala-3` =
(project in file(".")).settings(
scalaVersion := "3.3.0",
Compile / scalacOptions ++= CompileOptions.compileOptions,
libraryDependencies ++= Dependencies.dependencies,
- testFrameworks += new TestFramework("munit.Framework"),
- )
+ testFrameworks += new TestFramework("munit.Framework"))
sbt.addCommandAlias("runSolver", "runMain org.lunatechlabs.dotty.SudokuSolverMain")
diff --git a/exercises/exercise_001_dotty_deprecated_syntax_rewriting/project/Build.scala b/exercises/exercise_001_dotty_deprecated_syntax_rewriting/project/Build.scala
index ecf13483e..ee8ff2f88 100644
--- a/exercises/exercise_001_dotty_deprecated_syntax_rewriting/project/Build.scala
+++ b/exercises/exercise_001_dotty_deprecated_syntax_rewriting/project/Build.scala
@@ -7,43 +7,31 @@ object CompileOptions {
lazy val rewriteNoIndent = Seq("-rewrite", "-noindent")
lazy val rewriteOldSyntax = Seq("-rewrite", "-old-syntax")
- lazy val compileOptions = Seq(
- "-unchecked",
- "-deprecation",
- "-encoding", "UTF-8",
- "-source:future-migration",
- )
+ lazy val compileOptions = Seq("-unchecked", "-deprecation", "-encoding", "UTF-8", "-source:future-migration")
}
object Versions {
- lazy val akkaVer = "2.6.20"
- lazy val logbackVer = "1.2.3"
- lazy val mUnitVer = "0.7.26"
+ lazy val akkaVer = "2.6.20"
+ lazy val logbackVer = "1.2.3"
+ lazy val mUnitVer = "0.7.26"
}
object Dependencies {
private lazy val akkaDeps = Seq(
- "com.typesafe.akka" %% "akka-actor-typed",
- "com.typesafe.akka" %% "akka-slf4j",
- "com.typesafe.akka" %% "akka-stream",
- ).map (_ % Versions.akkaVer)
+ "com.typesafe.akka" %% "akka-actor-typed",
+ "com.typesafe.akka" %% "akka-slf4j",
+ "com.typesafe.akka" %% "akka-stream").map(_ % Versions.akkaVer)
- private lazy val akkaTestkitDeps = Seq(
- "com.typesafe.akka" %% "akka-actor-testkit-typed" % Versions.akkaVer % Test
- )
+ private lazy val akkaTestkitDeps = Seq("com.typesafe.akka" %% "akka-actor-testkit-typed" % Versions.akkaVer % Test)
- private lazy val logbackDeps = Seq (
- "ch.qos.logback" % "logback-classic",
- ).map (_ % Versions.logbackVer)
+ private lazy val logbackDeps = Seq("ch.qos.logback" % "logback-classic").map(_ % Versions.logbackVer)
- private lazy val munitDeps = Seq(
- "org.scalameta" %% "munit" % Versions.mUnitVer % Test
- )
+ private lazy val munitDeps = Seq("org.scalameta" %% "munit" % Versions.mUnitVer % Test)
lazy val dependencies: Seq[ModuleID] =
logbackDeps ++
- munitDeps ++
- akkaDeps ++
- akkaTestkitDeps
+ munitDeps ++
+ akkaDeps ++
+ akkaTestkitDeps
}
diff --git a/exercises/exercise_001_dotty_deprecated_syntax_rewriting/project/build.properties b/exercises/exercise_001_dotty_deprecated_syntax_rewriting/project/build.properties
index 72413de15..52413ab79 100644
--- a/exercises/exercise_001_dotty_deprecated_syntax_rewriting/project/build.properties
+++ b/exercises/exercise_001_dotty_deprecated_syntax_rewriting/project/build.properties
@@ -1 +1 @@
-sbt.version=1.8.3
+sbt.version=1.9.3
diff --git a/exercises/exercise_001_dotty_deprecated_syntax_rewriting/src/main/resources/application.conf b/exercises/exercise_001_dotty_deprecated_syntax_rewriting/src/main/resources/application.conf
index 14927baad..0b5d34e99 100644
--- a/exercises/exercise_001_dotty_deprecated_syntax_rewriting/src/main/resources/application.conf
+++ b/exercises/exercise_001_dotty_deprecated_syntax_rewriting/src/main/resources/application.conf
@@ -1,4 +1,8 @@
akka {
+ loggers = ["akka.event.slf4j.Slf4jLogger"]
+ loglevel = "INFO"
+ logging-filter = "akka.event.slf4j.Slf4jLoggingFilter"
+
log-dead-letters = on
logger-startup-timeout = 30s
diff --git a/exercises/exercise_001_dotty_deprecated_syntax_rewriting/src/main/resources/logback.xml b/exercises/exercise_001_dotty_deprecated_syntax_rewriting/src/main/resources/logback.xml
index 16cdaa5de..e28eccd9b 100644
--- a/exercises/exercise_001_dotty_deprecated_syntax_rewriting/src/main/resources/logback.xml
+++ b/exercises/exercise_001_dotty_deprecated_syntax_rewriting/src/main/resources/logback.xml
@@ -1,24 +1,24 @@
+
-
+
- info
+ INFO
- %date{HH:mm:ss} %-5level [%X{akkaSource}] - %msg%n
+ [%date{ISO8601}] [%level] [%logger] [%marker] [%thread] - %msg %n
-
-
-
-
-
-
-
+
+ target/sudoku.log
+
+ [%date{ISO8601}] [%level] [%logger] [%marker] [%thread] - %msg %n
+
+
-
-
+
+
+
-
diff --git a/exercises/exercise_001_dotty_deprecated_syntax_rewriting/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuProgressTracker.scala b/exercises/exercise_001_dotty_deprecated_syntax_rewriting/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuProgressTracker.scala
index b6b31c8d3..ee76c0fba 100644
--- a/exercises/exercise_001_dotty_deprecated_syntax_rewriting/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuProgressTracker.scala
+++ b/exercises/exercise_001_dotty_deprecated_syntax_rewriting/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuProgressTracker.scala
@@ -30,11 +30,13 @@ class SudokuProgressTracker private (
def trackProgress(updatesInFlight: Int): Behavior[Command] =
Behaviors.receiveMessage {
case NewUpdatesInFlight(updateCount) if updatesInFlight - 1 == 0 =>
+ context.log.debug("NewUpdatesInFlight({}) - UpdatesInFlight={}", updateCount, updatesInFlight + updateCount)
rowDetailProcessors.foreach { case (_, processor) =>
processor ! SudokuDetailProcessor.GetSudokuDetailState(context.self)
}
collectEndState()
case NewUpdatesInFlight(updateCount) =>
+ context.log.debug("NewUpdatesInFlight({}) - UpdatesInFlight={}", updateCount, updatesInFlight + updateCount)
trackProgress(updatesInFlight + updateCount)
case msg: SudokuDetailState =>
context.log.error("Received unexpected message in state 'trackProgress': {}", msg)
diff --git a/exercises/exercise_001_dotty_deprecated_syntax_rewriting/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuSolver.scala b/exercises/exercise_001_dotty_deprecated_syntax_rewriting/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuSolver.scala
index 4cc17169c..c6d156a71 100644
--- a/exercises/exercise_001_dotty_deprecated_syntax_rewriting/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuSolver.scala
+++ b/exercises/exercise_001_dotty_deprecated_syntax_rewriting/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuSolver.scala
@@ -74,6 +74,7 @@ class SudokuSolver private (context: ActorContext[SudokuSolver.Command], buffer:
rowUpdates.foreach { case SudokuDetailProcessor.RowUpdate(row, cellUpdates) =>
rowDetailProcessors(row) ! SudokuDetailProcessor.Update(cellUpdates, detailProcessorResponseMapper)
}
+ context.log.debug("InitialRowUpdates: {}", rowUpdates)
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(rowUpdates.size)
processRequest(Some(sender), System.currentTimeMillis())
case unexpectedMsg =>
@@ -88,38 +89,79 @@ class SudokuSolver private (context: ActorContext[SudokuSolver.Command], buffer:
response match {
case SudokuDetailProcessor.RowUpdate(rowNr, updates) =>
updates.foreach { case (rowCellNr, newCellContent) =>
+ context.log.debug("Incoming update for Row({},{})={} ", rowNr, rowCellNr, newCellContent)
val (columnNr, columnCellNr) = rowToColumnCoordinates(rowNr, rowCellNr)
val columnUpdate = Vector(columnCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from RowProcessor({}) for Column({}, {})={} ",
+ rowNr,
+ columnNr,
+ columnCellNr,
+ columnUpdate)
columnDetailProcessors(columnNr) ! SudokuDetailProcessor.Update(
columnUpdate,
detailProcessorResponseMapper)
val (blockNr, blockCellNr) = rowToBlockCoordinates(rowNr, rowCellNr)
val blockUpdate = Vector(blockCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from RowProcessor({}) for Block({}, {})={} ",
+ rowNr,
+ blockNr,
+ blockCellNr,
+ blockUpdate)
blockDetailProcessors(blockNr) ! SudokuDetailProcessor.Update(blockUpdate, detailProcessorResponseMapper)
}
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(2 * updates.size - 1)
Behaviors.same
case SudokuDetailProcessor.ColumnUpdate(columnNr, updates) =>
updates.foreach { case (colCellNr, newCellContent) =>
+ context.log.debug("Incoming update for Column({},{})={} ", columnNr, colCellNr, newCellContent)
val (rowNr, rowCellNr) = columnToRowCoordinates(columnNr, colCellNr)
val rowUpdate = Vector(rowCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from ColumnProcessor({}) for Row({}, {})={} ",
+ columnNr,
+ rowNr,
+ rowCellNr,
+ rowUpdate)
rowDetailProcessors(rowNr) ! SudokuDetailProcessor.Update(rowUpdate, detailProcessorResponseMapper)
val (blockNr, blockCellNr) = columnToBlockCoordinates(columnNr, colCellNr)
val blockUpdate = Vector(blockCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from ColumnProcessor({}) for Block({}, {})={} ",
+ columnNr,
+ blockNr,
+ blockCellNr,
+ blockUpdate)
blockDetailProcessors(blockNr) ! SudokuDetailProcessor.Update(blockUpdate, detailProcessorResponseMapper)
}
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(2 * updates.size - 1)
Behaviors.same
case SudokuDetailProcessor.BlockUpdate(blockNr, updates) =>
updates.foreach { case (blockCellNr, newCellContent) =>
+ context.log.debug("Incoming update for Block({},{})={} ", blockNr, blockCellNr, newCellContent)
val (rowNr, rowCellNr) = blockToRowCoordinates(blockNr, blockCellNr)
val rowUpdate = Vector(rowCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from BlockProcessor({}) for Row({}, {})={} ",
+ blockNr,
+ rowNr,
+ rowCellNr,
+ rowUpdate)
+
rowDetailProcessors(rowNr) ! SudokuDetailProcessor.Update(rowUpdate, detailProcessorResponseMapper)
val (columnNr, columnCellNr) = blockToColumnCoordinates(blockNr, blockCellNr)
val columnUpdate = Vector(columnCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from BlockProcessor({}) for Column({}, {})={} ",
+ blockNr,
+ columnNr,
+ columnCellNr,
+ columnUpdate)
+
columnDetailProcessors(columnNr) ! SudokuDetailProcessor.Update(
columnUpdate,
detailProcessorResponseMapper)
@@ -127,6 +169,7 @@ class SudokuSolver private (context: ActorContext[SudokuSolver.Command], buffer:
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(2 * updates.size - 1)
Behaviors.same
case unchanged @ SudokuDetailProcessor.SudokuDetailUnchanged =>
+ context.log.debug("SudokuDetailUnchanged")
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(-1)
Behaviors.same
}
@@ -134,6 +177,7 @@ class SudokuSolver private (context: ActorContext[SudokuSolver.Command], buffer:
result match {
case SudokuProgressTracker.Result(sudoku) =>
context.log.info(s"Sudoku processing time: ${System.currentTimeMillis() - startTime} milliseconds")
+ context.log.debug("Result: {}", sudoku)
requestor.get ! SudokuSolution(sudoku)
resetAllDetailProcessors()
buffer.unstashAll(idle())
diff --git a/exercises/exercise_002_dotty_new_syntax_and_indentation_based_syntax/build.sbt b/exercises/exercise_002_dotty_new_syntax_and_indentation_based_syntax/build.sbt
index 7dc71f9bc..d104338c1 100644
--- a/exercises/exercise_002_dotty_new_syntax_and_indentation_based_syntax/build.sbt
+++ b/exercises/exercise_002_dotty_new_syntax_and_indentation_based_syntax/build.sbt
@@ -1,12 +1,10 @@
Global / onChangedBuildSource := ReloadOnSourceChanges
-
lazy val `moving-from-scala-2-to-scala-3` =
(project in file(".")).settings(
scalaVersion := "3.3.0",
Compile / scalacOptions ++= CompileOptions.compileOptions,
libraryDependencies ++= Dependencies.dependencies,
- testFrameworks += new TestFramework("munit.Framework"),
- )
+ testFrameworks += new TestFramework("munit.Framework"))
sbt.addCommandAlias("runSolver", "runMain org.lunatechlabs.dotty.SudokuSolverMain")
diff --git a/exercises/exercise_002_dotty_new_syntax_and_indentation_based_syntax/project/Build.scala b/exercises/exercise_002_dotty_new_syntax_and_indentation_based_syntax/project/Build.scala
index ecf13483e..ee8ff2f88 100644
--- a/exercises/exercise_002_dotty_new_syntax_and_indentation_based_syntax/project/Build.scala
+++ b/exercises/exercise_002_dotty_new_syntax_and_indentation_based_syntax/project/Build.scala
@@ -7,43 +7,31 @@ object CompileOptions {
lazy val rewriteNoIndent = Seq("-rewrite", "-noindent")
lazy val rewriteOldSyntax = Seq("-rewrite", "-old-syntax")
- lazy val compileOptions = Seq(
- "-unchecked",
- "-deprecation",
- "-encoding", "UTF-8",
- "-source:future-migration",
- )
+ lazy val compileOptions = Seq("-unchecked", "-deprecation", "-encoding", "UTF-8", "-source:future-migration")
}
object Versions {
- lazy val akkaVer = "2.6.20"
- lazy val logbackVer = "1.2.3"
- lazy val mUnitVer = "0.7.26"
+ lazy val akkaVer = "2.6.20"
+ lazy val logbackVer = "1.2.3"
+ lazy val mUnitVer = "0.7.26"
}
object Dependencies {
private lazy val akkaDeps = Seq(
- "com.typesafe.akka" %% "akka-actor-typed",
- "com.typesafe.akka" %% "akka-slf4j",
- "com.typesafe.akka" %% "akka-stream",
- ).map (_ % Versions.akkaVer)
+ "com.typesafe.akka" %% "akka-actor-typed",
+ "com.typesafe.akka" %% "akka-slf4j",
+ "com.typesafe.akka" %% "akka-stream").map(_ % Versions.akkaVer)
- private lazy val akkaTestkitDeps = Seq(
- "com.typesafe.akka" %% "akka-actor-testkit-typed" % Versions.akkaVer % Test
- )
+ private lazy val akkaTestkitDeps = Seq("com.typesafe.akka" %% "akka-actor-testkit-typed" % Versions.akkaVer % Test)
- private lazy val logbackDeps = Seq (
- "ch.qos.logback" % "logback-classic",
- ).map (_ % Versions.logbackVer)
+ private lazy val logbackDeps = Seq("ch.qos.logback" % "logback-classic").map(_ % Versions.logbackVer)
- private lazy val munitDeps = Seq(
- "org.scalameta" %% "munit" % Versions.mUnitVer % Test
- )
+ private lazy val munitDeps = Seq("org.scalameta" %% "munit" % Versions.mUnitVer % Test)
lazy val dependencies: Seq[ModuleID] =
logbackDeps ++
- munitDeps ++
- akkaDeps ++
- akkaTestkitDeps
+ munitDeps ++
+ akkaDeps ++
+ akkaTestkitDeps
}
diff --git a/exercises/exercise_002_dotty_new_syntax_and_indentation_based_syntax/project/build.properties b/exercises/exercise_002_dotty_new_syntax_and_indentation_based_syntax/project/build.properties
index 72413de15..52413ab79 100644
--- a/exercises/exercise_002_dotty_new_syntax_and_indentation_based_syntax/project/build.properties
+++ b/exercises/exercise_002_dotty_new_syntax_and_indentation_based_syntax/project/build.properties
@@ -1 +1 @@
-sbt.version=1.8.3
+sbt.version=1.9.3
diff --git a/exercises/exercise_002_dotty_new_syntax_and_indentation_based_syntax/src/main/resources/application.conf b/exercises/exercise_002_dotty_new_syntax_and_indentation_based_syntax/src/main/resources/application.conf
index 14927baad..0b5d34e99 100644
--- a/exercises/exercise_002_dotty_new_syntax_and_indentation_based_syntax/src/main/resources/application.conf
+++ b/exercises/exercise_002_dotty_new_syntax_and_indentation_based_syntax/src/main/resources/application.conf
@@ -1,4 +1,8 @@
akka {
+ loggers = ["akka.event.slf4j.Slf4jLogger"]
+ loglevel = "INFO"
+ logging-filter = "akka.event.slf4j.Slf4jLoggingFilter"
+
log-dead-letters = on
logger-startup-timeout = 30s
diff --git a/exercises/exercise_002_dotty_new_syntax_and_indentation_based_syntax/src/main/resources/logback.xml b/exercises/exercise_002_dotty_new_syntax_and_indentation_based_syntax/src/main/resources/logback.xml
index 16cdaa5de..e28eccd9b 100644
--- a/exercises/exercise_002_dotty_new_syntax_and_indentation_based_syntax/src/main/resources/logback.xml
+++ b/exercises/exercise_002_dotty_new_syntax_and_indentation_based_syntax/src/main/resources/logback.xml
@@ -1,24 +1,24 @@
+
-
+
- info
+ INFO
- %date{HH:mm:ss} %-5level [%X{akkaSource}] - %msg%n
+ [%date{ISO8601}] [%level] [%logger] [%marker] [%thread] - %msg %n
-
-
-
-
-
-
-
+
+ target/sudoku.log
+
+ [%date{ISO8601}] [%level] [%logger] [%marker] [%thread] - %msg %n
+
+
-
-
+
+
+
-
diff --git a/exercises/exercise_002_dotty_new_syntax_and_indentation_based_syntax/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuProgressTracker.scala b/exercises/exercise_002_dotty_new_syntax_and_indentation_based_syntax/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuProgressTracker.scala
index ef7e7f1c6..620ba41f5 100644
--- a/exercises/exercise_002_dotty_new_syntax_and_indentation_based_syntax/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuProgressTracker.scala
+++ b/exercises/exercise_002_dotty_new_syntax_and_indentation_based_syntax/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuProgressTracker.scala
@@ -29,11 +29,13 @@ class SudokuProgressTracker private (
def trackProgress(updatesInFlight: Int): Behavior[Command] =
Behaviors.receiveMessage {
case NewUpdatesInFlight(updateCount) if updatesInFlight - 1 == 0 =>
+ context.log.debug("NewUpdatesInFlight({}) - UpdatesInFlight={}", updateCount, updatesInFlight + updateCount)
rowDetailProcessors.foreach { case (_, processor) =>
processor ! SudokuDetailProcessor.GetSudokuDetailState(context.self)
}
collectEndState()
case NewUpdatesInFlight(updateCount) =>
+ context.log.debug("NewUpdatesInFlight({}) - UpdatesInFlight={}", updateCount, updatesInFlight + updateCount)
trackProgress(updatesInFlight + updateCount)
case msg: SudokuDetailState =>
context.log.error("Received unexpected message in state 'trackProgress': {}", msg)
diff --git a/exercises/exercise_002_dotty_new_syntax_and_indentation_based_syntax/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuSolver.scala b/exercises/exercise_002_dotty_new_syntax_and_indentation_based_syntax/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuSolver.scala
index bf453c224..e6a1e2bbb 100644
--- a/exercises/exercise_002_dotty_new_syntax_and_indentation_based_syntax/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuSolver.scala
+++ b/exercises/exercise_002_dotty_new_syntax_and_indentation_based_syntax/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuSolver.scala
@@ -72,6 +72,7 @@ class SudokuSolver private (context: ActorContext[SudokuSolver.Command], buffer:
rowUpdates.foreach { case SudokuDetailProcessor.RowUpdate(row, cellUpdates) =>
rowDetailProcessors(row) ! SudokuDetailProcessor.Update(cellUpdates, detailProcessorResponseMapper)
}
+ context.log.debug("InitialRowUpdates: {}", rowUpdates)
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(rowUpdates.size)
processRequest(Some(sender), System.currentTimeMillis())
case unexpectedMsg =>
@@ -86,38 +87,79 @@ class SudokuSolver private (context: ActorContext[SudokuSolver.Command], buffer:
response match
case SudokuDetailProcessor.RowUpdate(rowNr, updates) =>
updates.foreach { case (rowCellNr, newCellContent) =>
+ context.log.debug("Incoming update for Row({},{})={} ", rowNr, rowCellNr, newCellContent)
val (columnNr, columnCellNr) = rowToColumnCoordinates(rowNr, rowCellNr)
val columnUpdate = Vector(columnCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from RowProcessor({}) for Column({}, {})={} ",
+ rowNr,
+ columnNr,
+ columnCellNr,
+ columnUpdate)
columnDetailProcessors(columnNr) ! SudokuDetailProcessor.Update(
columnUpdate,
detailProcessorResponseMapper)
val (blockNr, blockCellNr) = rowToBlockCoordinates(rowNr, rowCellNr)
val blockUpdate = Vector(blockCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from RowProcessor({}) for Block({}, {})={} ",
+ rowNr,
+ blockNr,
+ blockCellNr,
+ blockUpdate)
blockDetailProcessors(blockNr) ! SudokuDetailProcessor.Update(blockUpdate, detailProcessorResponseMapper)
}
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(2 * updates.size - 1)
Behaviors.same
case SudokuDetailProcessor.ColumnUpdate(columnNr, updates) =>
updates.foreach { case (colCellNr, newCellContent) =>
+ context.log.debug("Incoming update for Column({},{})={} ", columnNr, colCellNr, newCellContent)
val (rowNr, rowCellNr) = columnToRowCoordinates(columnNr, colCellNr)
val rowUpdate = Vector(rowCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from ColumnProcessor({}) for Row({}, {})={} ",
+ columnNr,
+ rowNr,
+ rowCellNr,
+ rowUpdate)
rowDetailProcessors(rowNr) ! SudokuDetailProcessor.Update(rowUpdate, detailProcessorResponseMapper)
val (blockNr, blockCellNr) = columnToBlockCoordinates(columnNr, colCellNr)
val blockUpdate = Vector(blockCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from ColumnProcessor({}) for Block({}, {})={} ",
+ columnNr,
+ blockNr,
+ blockCellNr,
+ blockUpdate)
blockDetailProcessors(blockNr) ! SudokuDetailProcessor.Update(blockUpdate, detailProcessorResponseMapper)
}
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(2 * updates.size - 1)
Behaviors.same
case SudokuDetailProcessor.BlockUpdate(blockNr, updates) =>
updates.foreach { case (blockCellNr, newCellContent) =>
+ context.log.debug("Incoming update for Block({},{})={} ", blockNr, blockCellNr, newCellContent)
val (rowNr, rowCellNr) = blockToRowCoordinates(blockNr, blockCellNr)
val rowUpdate = Vector(rowCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from BlockProcessor({}) for Row({}, {})={} ",
+ blockNr,
+ rowNr,
+ rowCellNr,
+ rowUpdate)
+
rowDetailProcessors(rowNr) ! SudokuDetailProcessor.Update(rowUpdate, detailProcessorResponseMapper)
val (columnNr, columnCellNr) = blockToColumnCoordinates(blockNr, blockCellNr)
val columnUpdate = Vector(columnCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from BlockProcessor({}) for Column({}, {})={} ",
+ blockNr,
+ columnNr,
+ columnCellNr,
+ columnUpdate)
+
columnDetailProcessors(columnNr) ! SudokuDetailProcessor.Update(
columnUpdate,
detailProcessorResponseMapper)
@@ -125,12 +167,14 @@ class SudokuSolver private (context: ActorContext[SudokuSolver.Command], buffer:
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(2 * updates.size - 1)
Behaviors.same
case unchanged @ SudokuDetailProcessor.SudokuDetailUnchanged =>
+ context.log.debug("SudokuDetailUnchanged")
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(-1)
Behaviors.same
case SudokuProgressTrackerResponseWrapped(result) =>
result match
case SudokuProgressTracker.Result(sudoku) =>
context.log.info(s"Sudoku processing time: ${System.currentTimeMillis() - startTime} milliseconds")
+ context.log.debug("Result: {}", sudoku)
requestor.get ! SudokuSolution(sudoku)
resetAllDetailProcessors()
buffer.unstashAll(idle())
diff --git a/exercises/exercise_003_top_level_definitions/build.sbt b/exercises/exercise_003_top_level_definitions/build.sbt
index 7dc71f9bc..d104338c1 100644
--- a/exercises/exercise_003_top_level_definitions/build.sbt
+++ b/exercises/exercise_003_top_level_definitions/build.sbt
@@ -1,12 +1,10 @@
Global / onChangedBuildSource := ReloadOnSourceChanges
-
lazy val `moving-from-scala-2-to-scala-3` =
(project in file(".")).settings(
scalaVersion := "3.3.0",
Compile / scalacOptions ++= CompileOptions.compileOptions,
libraryDependencies ++= Dependencies.dependencies,
- testFrameworks += new TestFramework("munit.Framework"),
- )
+ testFrameworks += new TestFramework("munit.Framework"))
sbt.addCommandAlias("runSolver", "runMain org.lunatechlabs.dotty.SudokuSolverMain")
diff --git a/exercises/exercise_003_top_level_definitions/project/Build.scala b/exercises/exercise_003_top_level_definitions/project/Build.scala
index ecf13483e..ee8ff2f88 100644
--- a/exercises/exercise_003_top_level_definitions/project/Build.scala
+++ b/exercises/exercise_003_top_level_definitions/project/Build.scala
@@ -7,43 +7,31 @@ object CompileOptions {
lazy val rewriteNoIndent = Seq("-rewrite", "-noindent")
lazy val rewriteOldSyntax = Seq("-rewrite", "-old-syntax")
- lazy val compileOptions = Seq(
- "-unchecked",
- "-deprecation",
- "-encoding", "UTF-8",
- "-source:future-migration",
- )
+ lazy val compileOptions = Seq("-unchecked", "-deprecation", "-encoding", "UTF-8", "-source:future-migration")
}
object Versions {
- lazy val akkaVer = "2.6.20"
- lazy val logbackVer = "1.2.3"
- lazy val mUnitVer = "0.7.26"
+ lazy val akkaVer = "2.6.20"
+ lazy val logbackVer = "1.2.3"
+ lazy val mUnitVer = "0.7.26"
}
object Dependencies {
private lazy val akkaDeps = Seq(
- "com.typesafe.akka" %% "akka-actor-typed",
- "com.typesafe.akka" %% "akka-slf4j",
- "com.typesafe.akka" %% "akka-stream",
- ).map (_ % Versions.akkaVer)
+ "com.typesafe.akka" %% "akka-actor-typed",
+ "com.typesafe.akka" %% "akka-slf4j",
+ "com.typesafe.akka" %% "akka-stream").map(_ % Versions.akkaVer)
- private lazy val akkaTestkitDeps = Seq(
- "com.typesafe.akka" %% "akka-actor-testkit-typed" % Versions.akkaVer % Test
- )
+ private lazy val akkaTestkitDeps = Seq("com.typesafe.akka" %% "akka-actor-testkit-typed" % Versions.akkaVer % Test)
- private lazy val logbackDeps = Seq (
- "ch.qos.logback" % "logback-classic",
- ).map (_ % Versions.logbackVer)
+ private lazy val logbackDeps = Seq("ch.qos.logback" % "logback-classic").map(_ % Versions.logbackVer)
- private lazy val munitDeps = Seq(
- "org.scalameta" %% "munit" % Versions.mUnitVer % Test
- )
+ private lazy val munitDeps = Seq("org.scalameta" %% "munit" % Versions.mUnitVer % Test)
lazy val dependencies: Seq[ModuleID] =
logbackDeps ++
- munitDeps ++
- akkaDeps ++
- akkaTestkitDeps
+ munitDeps ++
+ akkaDeps ++
+ akkaTestkitDeps
}
diff --git a/exercises/exercise_003_top_level_definitions/project/build.properties b/exercises/exercise_003_top_level_definitions/project/build.properties
index 72413de15..52413ab79 100644
--- a/exercises/exercise_003_top_level_definitions/project/build.properties
+++ b/exercises/exercise_003_top_level_definitions/project/build.properties
@@ -1 +1 @@
-sbt.version=1.8.3
+sbt.version=1.9.3
diff --git a/exercises/exercise_003_top_level_definitions/src/main/resources/application.conf b/exercises/exercise_003_top_level_definitions/src/main/resources/application.conf
index 14927baad..0b5d34e99 100644
--- a/exercises/exercise_003_top_level_definitions/src/main/resources/application.conf
+++ b/exercises/exercise_003_top_level_definitions/src/main/resources/application.conf
@@ -1,4 +1,8 @@
akka {
+ loggers = ["akka.event.slf4j.Slf4jLogger"]
+ loglevel = "INFO"
+ logging-filter = "akka.event.slf4j.Slf4jLoggingFilter"
+
log-dead-letters = on
logger-startup-timeout = 30s
diff --git a/exercises/exercise_003_top_level_definitions/src/main/resources/logback.xml b/exercises/exercise_003_top_level_definitions/src/main/resources/logback.xml
index 16cdaa5de..e28eccd9b 100644
--- a/exercises/exercise_003_top_level_definitions/src/main/resources/logback.xml
+++ b/exercises/exercise_003_top_level_definitions/src/main/resources/logback.xml
@@ -1,24 +1,24 @@
+
-
+
- info
+ INFO
- %date{HH:mm:ss} %-5level [%X{akkaSource}] - %msg%n
+ [%date{ISO8601}] [%level] [%logger] [%marker] [%thread] - %msg %n
-
-
-
-
-
-
-
+
+ target/sudoku.log
+
+ [%date{ISO8601}] [%level] [%logger] [%marker] [%thread] - %msg %n
+
+
-
-
+
+
+
-
diff --git a/exercises/exercise_003_top_level_definitions/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuProgressTracker.scala b/exercises/exercise_003_top_level_definitions/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuProgressTracker.scala
index ef7e7f1c6..620ba41f5 100644
--- a/exercises/exercise_003_top_level_definitions/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuProgressTracker.scala
+++ b/exercises/exercise_003_top_level_definitions/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuProgressTracker.scala
@@ -29,11 +29,13 @@ class SudokuProgressTracker private (
def trackProgress(updatesInFlight: Int): Behavior[Command] =
Behaviors.receiveMessage {
case NewUpdatesInFlight(updateCount) if updatesInFlight - 1 == 0 =>
+ context.log.debug("NewUpdatesInFlight({}) - UpdatesInFlight={}", updateCount, updatesInFlight + updateCount)
rowDetailProcessors.foreach { case (_, processor) =>
processor ! SudokuDetailProcessor.GetSudokuDetailState(context.self)
}
collectEndState()
case NewUpdatesInFlight(updateCount) =>
+ context.log.debug("NewUpdatesInFlight({}) - UpdatesInFlight={}", updateCount, updatesInFlight + updateCount)
trackProgress(updatesInFlight + updateCount)
case msg: SudokuDetailState =>
context.log.error("Received unexpected message in state 'trackProgress': {}", msg)
diff --git a/exercises/exercise_003_top_level_definitions/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuSolver.scala b/exercises/exercise_003_top_level_definitions/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuSolver.scala
index bf453c224..e6a1e2bbb 100644
--- a/exercises/exercise_003_top_level_definitions/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuSolver.scala
+++ b/exercises/exercise_003_top_level_definitions/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuSolver.scala
@@ -72,6 +72,7 @@ class SudokuSolver private (context: ActorContext[SudokuSolver.Command], buffer:
rowUpdates.foreach { case SudokuDetailProcessor.RowUpdate(row, cellUpdates) =>
rowDetailProcessors(row) ! SudokuDetailProcessor.Update(cellUpdates, detailProcessorResponseMapper)
}
+ context.log.debug("InitialRowUpdates: {}", rowUpdates)
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(rowUpdates.size)
processRequest(Some(sender), System.currentTimeMillis())
case unexpectedMsg =>
@@ -86,38 +87,79 @@ class SudokuSolver private (context: ActorContext[SudokuSolver.Command], buffer:
response match
case SudokuDetailProcessor.RowUpdate(rowNr, updates) =>
updates.foreach { case (rowCellNr, newCellContent) =>
+ context.log.debug("Incoming update for Row({},{})={} ", rowNr, rowCellNr, newCellContent)
val (columnNr, columnCellNr) = rowToColumnCoordinates(rowNr, rowCellNr)
val columnUpdate = Vector(columnCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from RowProcessor({}) for Column({}, {})={} ",
+ rowNr,
+ columnNr,
+ columnCellNr,
+ columnUpdate)
columnDetailProcessors(columnNr) ! SudokuDetailProcessor.Update(
columnUpdate,
detailProcessorResponseMapper)
val (blockNr, blockCellNr) = rowToBlockCoordinates(rowNr, rowCellNr)
val blockUpdate = Vector(blockCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from RowProcessor({}) for Block({}, {})={} ",
+ rowNr,
+ blockNr,
+ blockCellNr,
+ blockUpdate)
blockDetailProcessors(blockNr) ! SudokuDetailProcessor.Update(blockUpdate, detailProcessorResponseMapper)
}
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(2 * updates.size - 1)
Behaviors.same
case SudokuDetailProcessor.ColumnUpdate(columnNr, updates) =>
updates.foreach { case (colCellNr, newCellContent) =>
+ context.log.debug("Incoming update for Column({},{})={} ", columnNr, colCellNr, newCellContent)
val (rowNr, rowCellNr) = columnToRowCoordinates(columnNr, colCellNr)
val rowUpdate = Vector(rowCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from ColumnProcessor({}) for Row({}, {})={} ",
+ columnNr,
+ rowNr,
+ rowCellNr,
+ rowUpdate)
rowDetailProcessors(rowNr) ! SudokuDetailProcessor.Update(rowUpdate, detailProcessorResponseMapper)
val (blockNr, blockCellNr) = columnToBlockCoordinates(columnNr, colCellNr)
val blockUpdate = Vector(blockCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from ColumnProcessor({}) for Block({}, {})={} ",
+ columnNr,
+ blockNr,
+ blockCellNr,
+ blockUpdate)
blockDetailProcessors(blockNr) ! SudokuDetailProcessor.Update(blockUpdate, detailProcessorResponseMapper)
}
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(2 * updates.size - 1)
Behaviors.same
case SudokuDetailProcessor.BlockUpdate(blockNr, updates) =>
updates.foreach { case (blockCellNr, newCellContent) =>
+ context.log.debug("Incoming update for Block({},{})={} ", blockNr, blockCellNr, newCellContent)
val (rowNr, rowCellNr) = blockToRowCoordinates(blockNr, blockCellNr)
val rowUpdate = Vector(rowCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from BlockProcessor({}) for Row({}, {})={} ",
+ blockNr,
+ rowNr,
+ rowCellNr,
+ rowUpdate)
+
rowDetailProcessors(rowNr) ! SudokuDetailProcessor.Update(rowUpdate, detailProcessorResponseMapper)
val (columnNr, columnCellNr) = blockToColumnCoordinates(blockNr, blockCellNr)
val columnUpdate = Vector(columnCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from BlockProcessor({}) for Column({}, {})={} ",
+ blockNr,
+ columnNr,
+ columnCellNr,
+ columnUpdate)
+
columnDetailProcessors(columnNr) ! SudokuDetailProcessor.Update(
columnUpdate,
detailProcessorResponseMapper)
@@ -125,12 +167,14 @@ class SudokuSolver private (context: ActorContext[SudokuSolver.Command], buffer:
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(2 * updates.size - 1)
Behaviors.same
case unchanged @ SudokuDetailProcessor.SudokuDetailUnchanged =>
+ context.log.debug("SudokuDetailUnchanged")
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(-1)
Behaviors.same
case SudokuProgressTrackerResponseWrapped(result) =>
result match
case SudokuProgressTracker.Result(sudoku) =>
context.log.info(s"Sudoku processing time: ${System.currentTimeMillis() - startTime} milliseconds")
+ context.log.debug("Result: {}", sudoku)
requestor.get ! SudokuSolution(sudoku)
resetAllDetailProcessors()
buffer.unstashAll(idle())
diff --git a/exercises/exercise_004_parameter_untupling/build.sbt b/exercises/exercise_004_parameter_untupling/build.sbt
index 7dc71f9bc..d104338c1 100644
--- a/exercises/exercise_004_parameter_untupling/build.sbt
+++ b/exercises/exercise_004_parameter_untupling/build.sbt
@@ -1,12 +1,10 @@
Global / onChangedBuildSource := ReloadOnSourceChanges
-
lazy val `moving-from-scala-2-to-scala-3` =
(project in file(".")).settings(
scalaVersion := "3.3.0",
Compile / scalacOptions ++= CompileOptions.compileOptions,
libraryDependencies ++= Dependencies.dependencies,
- testFrameworks += new TestFramework("munit.Framework"),
- )
+ testFrameworks += new TestFramework("munit.Framework"))
sbt.addCommandAlias("runSolver", "runMain org.lunatechlabs.dotty.SudokuSolverMain")
diff --git a/exercises/exercise_004_parameter_untupling/project/Build.scala b/exercises/exercise_004_parameter_untupling/project/Build.scala
index ecf13483e..ee8ff2f88 100644
--- a/exercises/exercise_004_parameter_untupling/project/Build.scala
+++ b/exercises/exercise_004_parameter_untupling/project/Build.scala
@@ -7,43 +7,31 @@ object CompileOptions {
lazy val rewriteNoIndent = Seq("-rewrite", "-noindent")
lazy val rewriteOldSyntax = Seq("-rewrite", "-old-syntax")
- lazy val compileOptions = Seq(
- "-unchecked",
- "-deprecation",
- "-encoding", "UTF-8",
- "-source:future-migration",
- )
+ lazy val compileOptions = Seq("-unchecked", "-deprecation", "-encoding", "UTF-8", "-source:future-migration")
}
object Versions {
- lazy val akkaVer = "2.6.20"
- lazy val logbackVer = "1.2.3"
- lazy val mUnitVer = "0.7.26"
+ lazy val akkaVer = "2.6.20"
+ lazy val logbackVer = "1.2.3"
+ lazy val mUnitVer = "0.7.26"
}
object Dependencies {
private lazy val akkaDeps = Seq(
- "com.typesafe.akka" %% "akka-actor-typed",
- "com.typesafe.akka" %% "akka-slf4j",
- "com.typesafe.akka" %% "akka-stream",
- ).map (_ % Versions.akkaVer)
+ "com.typesafe.akka" %% "akka-actor-typed",
+ "com.typesafe.akka" %% "akka-slf4j",
+ "com.typesafe.akka" %% "akka-stream").map(_ % Versions.akkaVer)
- private lazy val akkaTestkitDeps = Seq(
- "com.typesafe.akka" %% "akka-actor-testkit-typed" % Versions.akkaVer % Test
- )
+ private lazy val akkaTestkitDeps = Seq("com.typesafe.akka" %% "akka-actor-testkit-typed" % Versions.akkaVer % Test)
- private lazy val logbackDeps = Seq (
- "ch.qos.logback" % "logback-classic",
- ).map (_ % Versions.logbackVer)
+ private lazy val logbackDeps = Seq("ch.qos.logback" % "logback-classic").map(_ % Versions.logbackVer)
- private lazy val munitDeps = Seq(
- "org.scalameta" %% "munit" % Versions.mUnitVer % Test
- )
+ private lazy val munitDeps = Seq("org.scalameta" %% "munit" % Versions.mUnitVer % Test)
lazy val dependencies: Seq[ModuleID] =
logbackDeps ++
- munitDeps ++
- akkaDeps ++
- akkaTestkitDeps
+ munitDeps ++
+ akkaDeps ++
+ akkaTestkitDeps
}
diff --git a/exercises/exercise_004_parameter_untupling/project/build.properties b/exercises/exercise_004_parameter_untupling/project/build.properties
index 72413de15..52413ab79 100644
--- a/exercises/exercise_004_parameter_untupling/project/build.properties
+++ b/exercises/exercise_004_parameter_untupling/project/build.properties
@@ -1 +1 @@
-sbt.version=1.8.3
+sbt.version=1.9.3
diff --git a/exercises/exercise_004_parameter_untupling/src/main/resources/application.conf b/exercises/exercise_004_parameter_untupling/src/main/resources/application.conf
index 14927baad..0b5d34e99 100644
--- a/exercises/exercise_004_parameter_untupling/src/main/resources/application.conf
+++ b/exercises/exercise_004_parameter_untupling/src/main/resources/application.conf
@@ -1,4 +1,8 @@
akka {
+ loggers = ["akka.event.slf4j.Slf4jLogger"]
+ loglevel = "INFO"
+ logging-filter = "akka.event.slf4j.Slf4jLoggingFilter"
+
log-dead-letters = on
logger-startup-timeout = 30s
diff --git a/exercises/exercise_004_parameter_untupling/src/main/resources/logback.xml b/exercises/exercise_004_parameter_untupling/src/main/resources/logback.xml
index 16cdaa5de..e28eccd9b 100644
--- a/exercises/exercise_004_parameter_untupling/src/main/resources/logback.xml
+++ b/exercises/exercise_004_parameter_untupling/src/main/resources/logback.xml
@@ -1,24 +1,24 @@
+
-
+
- info
+ INFO
- %date{HH:mm:ss} %-5level [%X{akkaSource}] - %msg%n
+ [%date{ISO8601}] [%level] [%logger] [%marker] [%thread] - %msg %n
-
-
-
-
-
-
-
+
+ target/sudoku.log
+
+ [%date{ISO8601}] [%level] [%logger] [%marker] [%thread] - %msg %n
+
+
-
-
+
+
+
-
diff --git a/exercises/exercise_004_parameter_untupling/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuProgressTracker.scala b/exercises/exercise_004_parameter_untupling/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuProgressTracker.scala
index e9a03e1e8..69b130ffc 100644
--- a/exercises/exercise_004_parameter_untupling/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuProgressTracker.scala
+++ b/exercises/exercise_004_parameter_untupling/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuProgressTracker.scala
@@ -29,10 +29,13 @@ class SudokuProgressTracker private (
def trackProgress(updatesInFlight: Int): Behavior[Command] =
Behaviors.receiveMessage {
case NewUpdatesInFlight(updateCount) if updatesInFlight - 1 == 0 =>
+ context.log.debug("NewUpdatesInFlight({}) - UpdatesInFlight={}", updateCount, updatesInFlight + updateCount)
rowDetailProcessors.foreach((_, processor) =>
processor ! SudokuDetailProcessor.GetSudokuDetailState(context.self))
+
collectEndState()
case NewUpdatesInFlight(updateCount) =>
+ context.log.debug("NewUpdatesInFlight({}) - UpdatesInFlight={}", updateCount, updatesInFlight + updateCount)
trackProgress(updatesInFlight + updateCount)
case msg: SudokuDetailState =>
context.log.error("Received unexpected message in state 'trackProgress': {}", msg)
diff --git a/exercises/exercise_004_parameter_untupling/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuSolver.scala b/exercises/exercise_004_parameter_untupling/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuSolver.scala
index dd64e0f37..44b32b30d 100644
--- a/exercises/exercise_004_parameter_untupling/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuSolver.scala
+++ b/exercises/exercise_004_parameter_untupling/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuSolver.scala
@@ -72,6 +72,7 @@ class SudokuSolver private (context: ActorContext[SudokuSolver.Command], buffer:
rowUpdates.foreach { case SudokuDetailProcessor.RowUpdate(row, cellUpdates) =>
rowDetailProcessors(row) ! SudokuDetailProcessor.Update(cellUpdates, detailProcessorResponseMapper)
}
+ context.log.debug("InitialRowUpdates: {}", rowUpdates)
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(rowUpdates.size)
processRequest(Some(sender), System.currentTimeMillis())
case unexpectedMsg =>
@@ -86,38 +87,79 @@ class SudokuSolver private (context: ActorContext[SudokuSolver.Command], buffer:
response match
case SudokuDetailProcessor.RowUpdate(rowNr, updates) =>
updates.foreach { (rowCellNr, newCellContent) =>
+ context.log.debug("Incoming update for Row({},{})={} ", rowNr, rowCellNr, newCellContent)
val (columnNr, columnCellNr) = rowToColumnCoordinates(rowNr, rowCellNr)
val columnUpdate = Vector(columnCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from RowProcessor({}) for Column({}, {})={} ",
+ rowNr,
+ columnNr,
+ columnCellNr,
+ columnUpdate)
columnDetailProcessors(columnNr) ! SudokuDetailProcessor.Update(
columnUpdate,
detailProcessorResponseMapper)
val (blockNr, blockCellNr) = rowToBlockCoordinates(rowNr, rowCellNr)
val blockUpdate = Vector(blockCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from RowProcessor({}) for Block({}, {})={} ",
+ rowNr,
+ blockNr,
+ blockCellNr,
+ blockUpdate)
blockDetailProcessors(blockNr) ! SudokuDetailProcessor.Update(blockUpdate, detailProcessorResponseMapper)
}
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(2 * updates.size - 1)
Behaviors.same
case SudokuDetailProcessor.ColumnUpdate(columnNr, updates) =>
updates.foreach { (colCellNr, newCellContent) =>
+ context.log.debug("Incoming update for Column({},{})={} ", columnNr, colCellNr, newCellContent)
val (rowNr, rowCellNr) = columnToRowCoordinates(columnNr, colCellNr)
val rowUpdate = Vector(rowCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from ColumnProcessor({}) for Row({}, {})={} ",
+ columnNr,
+ rowNr,
+ rowCellNr,
+ rowUpdate)
rowDetailProcessors(rowNr) ! SudokuDetailProcessor.Update(rowUpdate, detailProcessorResponseMapper)
val (blockNr, blockCellNr) = columnToBlockCoordinates(columnNr, colCellNr)
val blockUpdate = Vector(blockCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from ColumnProcessor({}) for Block({}, {})={} ",
+ columnNr,
+ blockNr,
+ blockCellNr,
+ blockUpdate)
blockDetailProcessors(blockNr) ! SudokuDetailProcessor.Update(blockUpdate, detailProcessorResponseMapper)
}
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(2 * updates.size - 1)
Behaviors.same
case SudokuDetailProcessor.BlockUpdate(blockNr, updates) =>
updates.foreach { (blockCellNr, newCellContent) =>
+ context.log.debug("Incoming update for Block({},{})={} ", blockNr, blockCellNr, newCellContent)
val (rowNr, rowCellNr) = blockToRowCoordinates(blockNr, blockCellNr)
val rowUpdate = Vector(rowCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from BlockProcessor({}) for Row({}, {})={} ",
+ blockNr,
+ rowNr,
+ rowCellNr,
+ rowUpdate)
+
rowDetailProcessors(rowNr) ! SudokuDetailProcessor.Update(rowUpdate, detailProcessorResponseMapper)
val (columnNr, columnCellNr) = blockToColumnCoordinates(blockNr, blockCellNr)
val columnUpdate = Vector(columnCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from BlockProcessor({}) for Column({}, {})={} ",
+ blockNr,
+ columnNr,
+ columnCellNr,
+ columnUpdate)
+
columnDetailProcessors(columnNr) ! SudokuDetailProcessor.Update(
columnUpdate,
detailProcessorResponseMapper)
@@ -125,12 +167,14 @@ class SudokuSolver private (context: ActorContext[SudokuSolver.Command], buffer:
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(2 * updates.size - 1)
Behaviors.same
case unchanged @ SudokuDetailProcessor.SudokuDetailUnchanged =>
+ context.log.debug("SudokuDetailUnchanged")
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(-1)
Behaviors.same
case SudokuProgressTrackerResponseWrapped(result) =>
result match
case SudokuProgressTracker.Result(sudoku) =>
context.log.info(s"Sudoku processing time: ${System.currentTimeMillis() - startTime} milliseconds")
+ context.log.debug("Result: {}", sudoku)
requestor.get ! SudokuSolution(sudoku)
resetAllDetailProcessors()
buffer.unstashAll(idle())
diff --git a/exercises/exercise_005_extension_methods/build.sbt b/exercises/exercise_005_extension_methods/build.sbt
index 7dc71f9bc..d104338c1 100644
--- a/exercises/exercise_005_extension_methods/build.sbt
+++ b/exercises/exercise_005_extension_methods/build.sbt
@@ -1,12 +1,10 @@
Global / onChangedBuildSource := ReloadOnSourceChanges
-
lazy val `moving-from-scala-2-to-scala-3` =
(project in file(".")).settings(
scalaVersion := "3.3.0",
Compile / scalacOptions ++= CompileOptions.compileOptions,
libraryDependencies ++= Dependencies.dependencies,
- testFrameworks += new TestFramework("munit.Framework"),
- )
+ testFrameworks += new TestFramework("munit.Framework"))
sbt.addCommandAlias("runSolver", "runMain org.lunatechlabs.dotty.SudokuSolverMain")
diff --git a/exercises/exercise_005_extension_methods/project/Build.scala b/exercises/exercise_005_extension_methods/project/Build.scala
index ecf13483e..ee8ff2f88 100644
--- a/exercises/exercise_005_extension_methods/project/Build.scala
+++ b/exercises/exercise_005_extension_methods/project/Build.scala
@@ -7,43 +7,31 @@ object CompileOptions {
lazy val rewriteNoIndent = Seq("-rewrite", "-noindent")
lazy val rewriteOldSyntax = Seq("-rewrite", "-old-syntax")
- lazy val compileOptions = Seq(
- "-unchecked",
- "-deprecation",
- "-encoding", "UTF-8",
- "-source:future-migration",
- )
+ lazy val compileOptions = Seq("-unchecked", "-deprecation", "-encoding", "UTF-8", "-source:future-migration")
}
object Versions {
- lazy val akkaVer = "2.6.20"
- lazy val logbackVer = "1.2.3"
- lazy val mUnitVer = "0.7.26"
+ lazy val akkaVer = "2.6.20"
+ lazy val logbackVer = "1.2.3"
+ lazy val mUnitVer = "0.7.26"
}
object Dependencies {
private lazy val akkaDeps = Seq(
- "com.typesafe.akka" %% "akka-actor-typed",
- "com.typesafe.akka" %% "akka-slf4j",
- "com.typesafe.akka" %% "akka-stream",
- ).map (_ % Versions.akkaVer)
+ "com.typesafe.akka" %% "akka-actor-typed",
+ "com.typesafe.akka" %% "akka-slf4j",
+ "com.typesafe.akka" %% "akka-stream").map(_ % Versions.akkaVer)
- private lazy val akkaTestkitDeps = Seq(
- "com.typesafe.akka" %% "akka-actor-testkit-typed" % Versions.akkaVer % Test
- )
+ private lazy val akkaTestkitDeps = Seq("com.typesafe.akka" %% "akka-actor-testkit-typed" % Versions.akkaVer % Test)
- private lazy val logbackDeps = Seq (
- "ch.qos.logback" % "logback-classic",
- ).map (_ % Versions.logbackVer)
+ private lazy val logbackDeps = Seq("ch.qos.logback" % "logback-classic").map(_ % Versions.logbackVer)
- private lazy val munitDeps = Seq(
- "org.scalameta" %% "munit" % Versions.mUnitVer % Test
- )
+ private lazy val munitDeps = Seq("org.scalameta" %% "munit" % Versions.mUnitVer % Test)
lazy val dependencies: Seq[ModuleID] =
logbackDeps ++
- munitDeps ++
- akkaDeps ++
- akkaTestkitDeps
+ munitDeps ++
+ akkaDeps ++
+ akkaTestkitDeps
}
diff --git a/exercises/exercise_005_extension_methods/project/build.properties b/exercises/exercise_005_extension_methods/project/build.properties
index 72413de15..52413ab79 100644
--- a/exercises/exercise_005_extension_methods/project/build.properties
+++ b/exercises/exercise_005_extension_methods/project/build.properties
@@ -1 +1 @@
-sbt.version=1.8.3
+sbt.version=1.9.3
diff --git a/exercises/exercise_005_extension_methods/src/main/resources/application.conf b/exercises/exercise_005_extension_methods/src/main/resources/application.conf
index 14927baad..0b5d34e99 100644
--- a/exercises/exercise_005_extension_methods/src/main/resources/application.conf
+++ b/exercises/exercise_005_extension_methods/src/main/resources/application.conf
@@ -1,4 +1,8 @@
akka {
+ loggers = ["akka.event.slf4j.Slf4jLogger"]
+ loglevel = "INFO"
+ logging-filter = "akka.event.slf4j.Slf4jLoggingFilter"
+
log-dead-letters = on
logger-startup-timeout = 30s
diff --git a/exercises/exercise_005_extension_methods/src/main/resources/logback.xml b/exercises/exercise_005_extension_methods/src/main/resources/logback.xml
index 16cdaa5de..e28eccd9b 100644
--- a/exercises/exercise_005_extension_methods/src/main/resources/logback.xml
+++ b/exercises/exercise_005_extension_methods/src/main/resources/logback.xml
@@ -1,24 +1,24 @@
+
-
+
- info
+ INFO
- %date{HH:mm:ss} %-5level [%X{akkaSource}] - %msg%n
+ [%date{ISO8601}] [%level] [%logger] [%marker] [%thread] - %msg %n
-
-
-
-
-
-
-
+
+ target/sudoku.log
+
+ [%date{ISO8601}] [%level] [%logger] [%marker] [%thread] - %msg %n
+
+
-
-
+
+
+
-
diff --git a/exercises/exercise_005_extension_methods/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuProgressTracker.scala b/exercises/exercise_005_extension_methods/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuProgressTracker.scala
index e9a03e1e8..69b130ffc 100644
--- a/exercises/exercise_005_extension_methods/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuProgressTracker.scala
+++ b/exercises/exercise_005_extension_methods/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuProgressTracker.scala
@@ -29,10 +29,13 @@ class SudokuProgressTracker private (
def trackProgress(updatesInFlight: Int): Behavior[Command] =
Behaviors.receiveMessage {
case NewUpdatesInFlight(updateCount) if updatesInFlight - 1 == 0 =>
+ context.log.debug("NewUpdatesInFlight({}) - UpdatesInFlight={}", updateCount, updatesInFlight + updateCount)
rowDetailProcessors.foreach((_, processor) =>
processor ! SudokuDetailProcessor.GetSudokuDetailState(context.self))
+
collectEndState()
case NewUpdatesInFlight(updateCount) =>
+ context.log.debug("NewUpdatesInFlight({}) - UpdatesInFlight={}", updateCount, updatesInFlight + updateCount)
trackProgress(updatesInFlight + updateCount)
case msg: SudokuDetailState =>
context.log.error("Received unexpected message in state 'trackProgress': {}", msg)
diff --git a/exercises/exercise_005_extension_methods/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuSolver.scala b/exercises/exercise_005_extension_methods/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuSolver.scala
index dd64e0f37..44b32b30d 100644
--- a/exercises/exercise_005_extension_methods/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuSolver.scala
+++ b/exercises/exercise_005_extension_methods/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuSolver.scala
@@ -72,6 +72,7 @@ class SudokuSolver private (context: ActorContext[SudokuSolver.Command], buffer:
rowUpdates.foreach { case SudokuDetailProcessor.RowUpdate(row, cellUpdates) =>
rowDetailProcessors(row) ! SudokuDetailProcessor.Update(cellUpdates, detailProcessorResponseMapper)
}
+ context.log.debug("InitialRowUpdates: {}", rowUpdates)
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(rowUpdates.size)
processRequest(Some(sender), System.currentTimeMillis())
case unexpectedMsg =>
@@ -86,38 +87,79 @@ class SudokuSolver private (context: ActorContext[SudokuSolver.Command], buffer:
response match
case SudokuDetailProcessor.RowUpdate(rowNr, updates) =>
updates.foreach { (rowCellNr, newCellContent) =>
+ context.log.debug("Incoming update for Row({},{})={} ", rowNr, rowCellNr, newCellContent)
val (columnNr, columnCellNr) = rowToColumnCoordinates(rowNr, rowCellNr)
val columnUpdate = Vector(columnCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from RowProcessor({}) for Column({}, {})={} ",
+ rowNr,
+ columnNr,
+ columnCellNr,
+ columnUpdate)
columnDetailProcessors(columnNr) ! SudokuDetailProcessor.Update(
columnUpdate,
detailProcessorResponseMapper)
val (blockNr, blockCellNr) = rowToBlockCoordinates(rowNr, rowCellNr)
val blockUpdate = Vector(blockCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from RowProcessor({}) for Block({}, {})={} ",
+ rowNr,
+ blockNr,
+ blockCellNr,
+ blockUpdate)
blockDetailProcessors(blockNr) ! SudokuDetailProcessor.Update(blockUpdate, detailProcessorResponseMapper)
}
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(2 * updates.size - 1)
Behaviors.same
case SudokuDetailProcessor.ColumnUpdate(columnNr, updates) =>
updates.foreach { (colCellNr, newCellContent) =>
+ context.log.debug("Incoming update for Column({},{})={} ", columnNr, colCellNr, newCellContent)
val (rowNr, rowCellNr) = columnToRowCoordinates(columnNr, colCellNr)
val rowUpdate = Vector(rowCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from ColumnProcessor({}) for Row({}, {})={} ",
+ columnNr,
+ rowNr,
+ rowCellNr,
+ rowUpdate)
rowDetailProcessors(rowNr) ! SudokuDetailProcessor.Update(rowUpdate, detailProcessorResponseMapper)
val (blockNr, blockCellNr) = columnToBlockCoordinates(columnNr, colCellNr)
val blockUpdate = Vector(blockCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from ColumnProcessor({}) for Block({}, {})={} ",
+ columnNr,
+ blockNr,
+ blockCellNr,
+ blockUpdate)
blockDetailProcessors(blockNr) ! SudokuDetailProcessor.Update(blockUpdate, detailProcessorResponseMapper)
}
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(2 * updates.size - 1)
Behaviors.same
case SudokuDetailProcessor.BlockUpdate(blockNr, updates) =>
updates.foreach { (blockCellNr, newCellContent) =>
+ context.log.debug("Incoming update for Block({},{})={} ", blockNr, blockCellNr, newCellContent)
val (rowNr, rowCellNr) = blockToRowCoordinates(blockNr, blockCellNr)
val rowUpdate = Vector(rowCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from BlockProcessor({}) for Row({}, {})={} ",
+ blockNr,
+ rowNr,
+ rowCellNr,
+ rowUpdate)
+
rowDetailProcessors(rowNr) ! SudokuDetailProcessor.Update(rowUpdate, detailProcessorResponseMapper)
val (columnNr, columnCellNr) = blockToColumnCoordinates(blockNr, blockCellNr)
val columnUpdate = Vector(columnCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from BlockProcessor({}) for Column({}, {})={} ",
+ blockNr,
+ columnNr,
+ columnCellNr,
+ columnUpdate)
+
columnDetailProcessors(columnNr) ! SudokuDetailProcessor.Update(
columnUpdate,
detailProcessorResponseMapper)
@@ -125,12 +167,14 @@ class SudokuSolver private (context: ActorContext[SudokuSolver.Command], buffer:
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(2 * updates.size - 1)
Behaviors.same
case unchanged @ SudokuDetailProcessor.SudokuDetailUnchanged =>
+ context.log.debug("SudokuDetailUnchanged")
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(-1)
Behaviors.same
case SudokuProgressTrackerResponseWrapped(result) =>
result match
case SudokuProgressTracker.Result(sudoku) =>
context.log.info(s"Sudoku processing time: ${System.currentTimeMillis() - startTime} milliseconds")
+ context.log.debug("Result: {}", sudoku)
requestor.get ! SudokuSolution(sudoku)
resetAllDetailProcessors()
buffer.unstashAll(idle())
diff --git a/exercises/exercise_006_using_and_summon/build.sbt b/exercises/exercise_006_using_and_summon/build.sbt
index 7dc71f9bc..d104338c1 100644
--- a/exercises/exercise_006_using_and_summon/build.sbt
+++ b/exercises/exercise_006_using_and_summon/build.sbt
@@ -1,12 +1,10 @@
Global / onChangedBuildSource := ReloadOnSourceChanges
-
lazy val `moving-from-scala-2-to-scala-3` =
(project in file(".")).settings(
scalaVersion := "3.3.0",
Compile / scalacOptions ++= CompileOptions.compileOptions,
libraryDependencies ++= Dependencies.dependencies,
- testFrameworks += new TestFramework("munit.Framework"),
- )
+ testFrameworks += new TestFramework("munit.Framework"))
sbt.addCommandAlias("runSolver", "runMain org.lunatechlabs.dotty.SudokuSolverMain")
diff --git a/exercises/exercise_006_using_and_summon/project/Build.scala b/exercises/exercise_006_using_and_summon/project/Build.scala
index ecf13483e..ee8ff2f88 100644
--- a/exercises/exercise_006_using_and_summon/project/Build.scala
+++ b/exercises/exercise_006_using_and_summon/project/Build.scala
@@ -7,43 +7,31 @@ object CompileOptions {
lazy val rewriteNoIndent = Seq("-rewrite", "-noindent")
lazy val rewriteOldSyntax = Seq("-rewrite", "-old-syntax")
- lazy val compileOptions = Seq(
- "-unchecked",
- "-deprecation",
- "-encoding", "UTF-8",
- "-source:future-migration",
- )
+ lazy val compileOptions = Seq("-unchecked", "-deprecation", "-encoding", "UTF-8", "-source:future-migration")
}
object Versions {
- lazy val akkaVer = "2.6.20"
- lazy val logbackVer = "1.2.3"
- lazy val mUnitVer = "0.7.26"
+ lazy val akkaVer = "2.6.20"
+ lazy val logbackVer = "1.2.3"
+ lazy val mUnitVer = "0.7.26"
}
object Dependencies {
private lazy val akkaDeps = Seq(
- "com.typesafe.akka" %% "akka-actor-typed",
- "com.typesafe.akka" %% "akka-slf4j",
- "com.typesafe.akka" %% "akka-stream",
- ).map (_ % Versions.akkaVer)
+ "com.typesafe.akka" %% "akka-actor-typed",
+ "com.typesafe.akka" %% "akka-slf4j",
+ "com.typesafe.akka" %% "akka-stream").map(_ % Versions.akkaVer)
- private lazy val akkaTestkitDeps = Seq(
- "com.typesafe.akka" %% "akka-actor-testkit-typed" % Versions.akkaVer % Test
- )
+ private lazy val akkaTestkitDeps = Seq("com.typesafe.akka" %% "akka-actor-testkit-typed" % Versions.akkaVer % Test)
- private lazy val logbackDeps = Seq (
- "ch.qos.logback" % "logback-classic",
- ).map (_ % Versions.logbackVer)
+ private lazy val logbackDeps = Seq("ch.qos.logback" % "logback-classic").map(_ % Versions.logbackVer)
- private lazy val munitDeps = Seq(
- "org.scalameta" %% "munit" % Versions.mUnitVer % Test
- )
+ private lazy val munitDeps = Seq("org.scalameta" %% "munit" % Versions.mUnitVer % Test)
lazy val dependencies: Seq[ModuleID] =
logbackDeps ++
- munitDeps ++
- akkaDeps ++
- akkaTestkitDeps
+ munitDeps ++
+ akkaDeps ++
+ akkaTestkitDeps
}
diff --git a/exercises/exercise_006_using_and_summon/project/build.properties b/exercises/exercise_006_using_and_summon/project/build.properties
index 72413de15..52413ab79 100644
--- a/exercises/exercise_006_using_and_summon/project/build.properties
+++ b/exercises/exercise_006_using_and_summon/project/build.properties
@@ -1 +1 @@
-sbt.version=1.8.3
+sbt.version=1.9.3
diff --git a/exercises/exercise_006_using_and_summon/src/main/resources/application.conf b/exercises/exercise_006_using_and_summon/src/main/resources/application.conf
index 14927baad..0b5d34e99 100644
--- a/exercises/exercise_006_using_and_summon/src/main/resources/application.conf
+++ b/exercises/exercise_006_using_and_summon/src/main/resources/application.conf
@@ -1,4 +1,8 @@
akka {
+ loggers = ["akka.event.slf4j.Slf4jLogger"]
+ loglevel = "INFO"
+ logging-filter = "akka.event.slf4j.Slf4jLoggingFilter"
+
log-dead-letters = on
logger-startup-timeout = 30s
diff --git a/exercises/exercise_006_using_and_summon/src/main/resources/logback.xml b/exercises/exercise_006_using_and_summon/src/main/resources/logback.xml
index 16cdaa5de..e28eccd9b 100644
--- a/exercises/exercise_006_using_and_summon/src/main/resources/logback.xml
+++ b/exercises/exercise_006_using_and_summon/src/main/resources/logback.xml
@@ -1,24 +1,24 @@
+
-
+
- info
+ INFO
- %date{HH:mm:ss} %-5level [%X{akkaSource}] - %msg%n
+ [%date{ISO8601}] [%level] [%logger] [%marker] [%thread] - %msg %n
-
-
-
-
-
-
-
+
+ target/sudoku.log
+
+ [%date{ISO8601}] [%level] [%logger] [%marker] [%thread] - %msg %n
+
+
-
-
+
+
+
-
diff --git a/exercises/exercise_006_using_and_summon/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuProgressTracker.scala b/exercises/exercise_006_using_and_summon/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuProgressTracker.scala
index e9a03e1e8..69b130ffc 100644
--- a/exercises/exercise_006_using_and_summon/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuProgressTracker.scala
+++ b/exercises/exercise_006_using_and_summon/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuProgressTracker.scala
@@ -29,10 +29,13 @@ class SudokuProgressTracker private (
def trackProgress(updatesInFlight: Int): Behavior[Command] =
Behaviors.receiveMessage {
case NewUpdatesInFlight(updateCount) if updatesInFlight - 1 == 0 =>
+ context.log.debug("NewUpdatesInFlight({}) - UpdatesInFlight={}", updateCount, updatesInFlight + updateCount)
rowDetailProcessors.foreach((_, processor) =>
processor ! SudokuDetailProcessor.GetSudokuDetailState(context.self))
+
collectEndState()
case NewUpdatesInFlight(updateCount) =>
+ context.log.debug("NewUpdatesInFlight({}) - UpdatesInFlight={}", updateCount, updatesInFlight + updateCount)
trackProgress(updatesInFlight + updateCount)
case msg: SudokuDetailState =>
context.log.error("Received unexpected message in state 'trackProgress': {}", msg)
diff --git a/exercises/exercise_006_using_and_summon/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuSolver.scala b/exercises/exercise_006_using_and_summon/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuSolver.scala
index 844fabfab..f286a29b4 100644
--- a/exercises/exercise_006_using_and_summon/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuSolver.scala
+++ b/exercises/exercise_006_using_and_summon/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuSolver.scala
@@ -72,6 +72,7 @@ class SudokuSolver private (context: ActorContext[SudokuSolver.Command], buffer:
rowUpdates.foreach { case SudokuDetailProcessor.RowUpdate(row, cellUpdates) =>
rowDetailProcessors(row) ! SudokuDetailProcessor.Update(cellUpdates, detailProcessorResponseMapper)
}
+ context.log.debug("InitialRowUpdates: {}", rowUpdates)
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(rowUpdates.size)
processRequest(Some(sender), System.currentTimeMillis())
case unexpectedMsg =>
@@ -86,38 +87,79 @@ class SudokuSolver private (context: ActorContext[SudokuSolver.Command], buffer:
response match
case SudokuDetailProcessor.RowUpdate(rowNr, updates) =>
updates.foreach { (rowCellNr, newCellContent) =>
+ context.log.debug("Incoming update for Row({},{})={} ", rowNr, rowCellNr, newCellContent)
val (columnNr, columnCellNr) = rowToColumnCoordinates(rowNr, rowCellNr)
val columnUpdate = Vector(columnCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from RowProcessor({}) for Column({}, {})={} ",
+ rowNr,
+ columnNr,
+ columnCellNr,
+ columnUpdate)
columnDetailProcessors(columnNr) ! SudokuDetailProcessor.Update(
columnUpdate,
detailProcessorResponseMapper)
val (blockNr, blockCellNr) = rowToBlockCoordinates(rowNr, rowCellNr)
val blockUpdate = Vector(blockCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from RowProcessor({}) for Block({}, {})={} ",
+ rowNr,
+ blockNr,
+ blockCellNr,
+ blockUpdate)
blockDetailProcessors(blockNr) ! SudokuDetailProcessor.Update(blockUpdate, detailProcessorResponseMapper)
}
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(2 * updates.size - 1)
Behaviors.same
case SudokuDetailProcessor.ColumnUpdate(columnNr, updates) =>
updates.foreach { (colCellNr, newCellContent) =>
+ context.log.debug("Incoming update for Column({},{})={} ", columnNr, colCellNr, newCellContent)
val (rowNr, rowCellNr) = columnToRowCoordinates(columnNr, colCellNr)
val rowUpdate = Vector(rowCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from ColumnProcessor({}) for Row({}, {})={} ",
+ columnNr,
+ rowNr,
+ rowCellNr,
+ rowUpdate)
rowDetailProcessors(rowNr) ! SudokuDetailProcessor.Update(rowUpdate, detailProcessorResponseMapper)
val (blockNr, blockCellNr) = columnToBlockCoordinates(columnNr, colCellNr)
val blockUpdate = Vector(blockCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from ColumnProcessor({}) for Block({}, {})={} ",
+ columnNr,
+ blockNr,
+ blockCellNr,
+ blockUpdate)
blockDetailProcessors(blockNr) ! SudokuDetailProcessor.Update(blockUpdate, detailProcessorResponseMapper)
}
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(2 * updates.size - 1)
Behaviors.same
case SudokuDetailProcessor.BlockUpdate(blockNr, updates) =>
updates.foreach { (blockCellNr, newCellContent) =>
+ context.log.debug("Incoming update for Block({},{})={} ", blockNr, blockCellNr, newCellContent)
val (rowNr, rowCellNr) = blockToRowCoordinates(blockNr, blockCellNr)
val rowUpdate = Vector(rowCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from BlockProcessor({}) for Row({}, {})={} ",
+ blockNr,
+ rowNr,
+ rowCellNr,
+ rowUpdate)
+
rowDetailProcessors(rowNr) ! SudokuDetailProcessor.Update(rowUpdate, detailProcessorResponseMapper)
val (columnNr, columnCellNr) = blockToColumnCoordinates(blockNr, blockCellNr)
val columnUpdate = Vector(columnCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from BlockProcessor({}) for Column({}, {})={} ",
+ blockNr,
+ columnNr,
+ columnCellNr,
+ columnUpdate)
+
columnDetailProcessors(columnNr) ! SudokuDetailProcessor.Update(
columnUpdate,
detailProcessorResponseMapper)
@@ -125,12 +167,14 @@ class SudokuSolver private (context: ActorContext[SudokuSolver.Command], buffer:
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(2 * updates.size - 1)
Behaviors.same
case unchanged @ SudokuDetailProcessor.SudokuDetailUnchanged =>
+ context.log.debug("SudokuDetailUnchanged")
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(-1)
Behaviors.same
case SudokuProgressTrackerResponseWrapped(result) =>
result match
case SudokuProgressTracker.Result(sudoku) =>
context.log.info(s"Sudoku processing time: ${System.currentTimeMillis() - startTime} milliseconds")
+ context.log.debug("Result: {}", sudoku)
requestor.get ! SudokuSolution(sudoku)
resetAllDetailProcessors()
buffer.unstashAll(idle())
diff --git a/exercises/exercise_007_givens/build.sbt b/exercises/exercise_007_givens/build.sbt
index 7dc71f9bc..d104338c1 100644
--- a/exercises/exercise_007_givens/build.sbt
+++ b/exercises/exercise_007_givens/build.sbt
@@ -1,12 +1,10 @@
Global / onChangedBuildSource := ReloadOnSourceChanges
-
lazy val `moving-from-scala-2-to-scala-3` =
(project in file(".")).settings(
scalaVersion := "3.3.0",
Compile / scalacOptions ++= CompileOptions.compileOptions,
libraryDependencies ++= Dependencies.dependencies,
- testFrameworks += new TestFramework("munit.Framework"),
- )
+ testFrameworks += new TestFramework("munit.Framework"))
sbt.addCommandAlias("runSolver", "runMain org.lunatechlabs.dotty.SudokuSolverMain")
diff --git a/exercises/exercise_007_givens/project/Build.scala b/exercises/exercise_007_givens/project/Build.scala
index ecf13483e..ee8ff2f88 100644
--- a/exercises/exercise_007_givens/project/Build.scala
+++ b/exercises/exercise_007_givens/project/Build.scala
@@ -7,43 +7,31 @@ object CompileOptions {
lazy val rewriteNoIndent = Seq("-rewrite", "-noindent")
lazy val rewriteOldSyntax = Seq("-rewrite", "-old-syntax")
- lazy val compileOptions = Seq(
- "-unchecked",
- "-deprecation",
- "-encoding", "UTF-8",
- "-source:future-migration",
- )
+ lazy val compileOptions = Seq("-unchecked", "-deprecation", "-encoding", "UTF-8", "-source:future-migration")
}
object Versions {
- lazy val akkaVer = "2.6.20"
- lazy val logbackVer = "1.2.3"
- lazy val mUnitVer = "0.7.26"
+ lazy val akkaVer = "2.6.20"
+ lazy val logbackVer = "1.2.3"
+ lazy val mUnitVer = "0.7.26"
}
object Dependencies {
private lazy val akkaDeps = Seq(
- "com.typesafe.akka" %% "akka-actor-typed",
- "com.typesafe.akka" %% "akka-slf4j",
- "com.typesafe.akka" %% "akka-stream",
- ).map (_ % Versions.akkaVer)
+ "com.typesafe.akka" %% "akka-actor-typed",
+ "com.typesafe.akka" %% "akka-slf4j",
+ "com.typesafe.akka" %% "akka-stream").map(_ % Versions.akkaVer)
- private lazy val akkaTestkitDeps = Seq(
- "com.typesafe.akka" %% "akka-actor-testkit-typed" % Versions.akkaVer % Test
- )
+ private lazy val akkaTestkitDeps = Seq("com.typesafe.akka" %% "akka-actor-testkit-typed" % Versions.akkaVer % Test)
- private lazy val logbackDeps = Seq (
- "ch.qos.logback" % "logback-classic",
- ).map (_ % Versions.logbackVer)
+ private lazy val logbackDeps = Seq("ch.qos.logback" % "logback-classic").map(_ % Versions.logbackVer)
- private lazy val munitDeps = Seq(
- "org.scalameta" %% "munit" % Versions.mUnitVer % Test
- )
+ private lazy val munitDeps = Seq("org.scalameta" %% "munit" % Versions.mUnitVer % Test)
lazy val dependencies: Seq[ModuleID] =
logbackDeps ++
- munitDeps ++
- akkaDeps ++
- akkaTestkitDeps
+ munitDeps ++
+ akkaDeps ++
+ akkaTestkitDeps
}
diff --git a/exercises/exercise_007_givens/project/build.properties b/exercises/exercise_007_givens/project/build.properties
index 72413de15..52413ab79 100644
--- a/exercises/exercise_007_givens/project/build.properties
+++ b/exercises/exercise_007_givens/project/build.properties
@@ -1 +1 @@
-sbt.version=1.8.3
+sbt.version=1.9.3
diff --git a/exercises/exercise_007_givens/src/main/resources/application.conf b/exercises/exercise_007_givens/src/main/resources/application.conf
index 14927baad..0b5d34e99 100644
--- a/exercises/exercise_007_givens/src/main/resources/application.conf
+++ b/exercises/exercise_007_givens/src/main/resources/application.conf
@@ -1,4 +1,8 @@
akka {
+ loggers = ["akka.event.slf4j.Slf4jLogger"]
+ loglevel = "INFO"
+ logging-filter = "akka.event.slf4j.Slf4jLoggingFilter"
+
log-dead-letters = on
logger-startup-timeout = 30s
diff --git a/exercises/exercise_007_givens/src/main/resources/logback.xml b/exercises/exercise_007_givens/src/main/resources/logback.xml
index 16cdaa5de..e28eccd9b 100644
--- a/exercises/exercise_007_givens/src/main/resources/logback.xml
+++ b/exercises/exercise_007_givens/src/main/resources/logback.xml
@@ -1,24 +1,24 @@
+
-
+
- info
+ INFO
- %date{HH:mm:ss} %-5level [%X{akkaSource}] - %msg%n
+ [%date{ISO8601}] [%level] [%logger] [%marker] [%thread] - %msg %n
-
-
-
-
-
-
-
+
+ target/sudoku.log
+
+ [%date{ISO8601}] [%level] [%logger] [%marker] [%thread] - %msg %n
+
+
-
-
+
+
+
-
diff --git a/exercises/exercise_007_givens/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuProgressTracker.scala b/exercises/exercise_007_givens/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuProgressTracker.scala
index e9a03e1e8..69b130ffc 100644
--- a/exercises/exercise_007_givens/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuProgressTracker.scala
+++ b/exercises/exercise_007_givens/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuProgressTracker.scala
@@ -29,10 +29,13 @@ class SudokuProgressTracker private (
def trackProgress(updatesInFlight: Int): Behavior[Command] =
Behaviors.receiveMessage {
case NewUpdatesInFlight(updateCount) if updatesInFlight - 1 == 0 =>
+ context.log.debug("NewUpdatesInFlight({}) - UpdatesInFlight={}", updateCount, updatesInFlight + updateCount)
rowDetailProcessors.foreach((_, processor) =>
processor ! SudokuDetailProcessor.GetSudokuDetailState(context.self))
+
collectEndState()
case NewUpdatesInFlight(updateCount) =>
+ context.log.debug("NewUpdatesInFlight({}) - UpdatesInFlight={}", updateCount, updatesInFlight + updateCount)
trackProgress(updatesInFlight + updateCount)
case msg: SudokuDetailState =>
context.log.error("Received unexpected message in state 'trackProgress': {}", msg)
diff --git a/exercises/exercise_007_givens/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuSolver.scala b/exercises/exercise_007_givens/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuSolver.scala
index 844fabfab..f286a29b4 100644
--- a/exercises/exercise_007_givens/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuSolver.scala
+++ b/exercises/exercise_007_givens/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuSolver.scala
@@ -72,6 +72,7 @@ class SudokuSolver private (context: ActorContext[SudokuSolver.Command], buffer:
rowUpdates.foreach { case SudokuDetailProcessor.RowUpdate(row, cellUpdates) =>
rowDetailProcessors(row) ! SudokuDetailProcessor.Update(cellUpdates, detailProcessorResponseMapper)
}
+ context.log.debug("InitialRowUpdates: {}", rowUpdates)
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(rowUpdates.size)
processRequest(Some(sender), System.currentTimeMillis())
case unexpectedMsg =>
@@ -86,38 +87,79 @@ class SudokuSolver private (context: ActorContext[SudokuSolver.Command], buffer:
response match
case SudokuDetailProcessor.RowUpdate(rowNr, updates) =>
updates.foreach { (rowCellNr, newCellContent) =>
+ context.log.debug("Incoming update for Row({},{})={} ", rowNr, rowCellNr, newCellContent)
val (columnNr, columnCellNr) = rowToColumnCoordinates(rowNr, rowCellNr)
val columnUpdate = Vector(columnCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from RowProcessor({}) for Column({}, {})={} ",
+ rowNr,
+ columnNr,
+ columnCellNr,
+ columnUpdate)
columnDetailProcessors(columnNr) ! SudokuDetailProcessor.Update(
columnUpdate,
detailProcessorResponseMapper)
val (blockNr, blockCellNr) = rowToBlockCoordinates(rowNr, rowCellNr)
val blockUpdate = Vector(blockCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from RowProcessor({}) for Block({}, {})={} ",
+ rowNr,
+ blockNr,
+ blockCellNr,
+ blockUpdate)
blockDetailProcessors(blockNr) ! SudokuDetailProcessor.Update(blockUpdate, detailProcessorResponseMapper)
}
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(2 * updates.size - 1)
Behaviors.same
case SudokuDetailProcessor.ColumnUpdate(columnNr, updates) =>
updates.foreach { (colCellNr, newCellContent) =>
+ context.log.debug("Incoming update for Column({},{})={} ", columnNr, colCellNr, newCellContent)
val (rowNr, rowCellNr) = columnToRowCoordinates(columnNr, colCellNr)
val rowUpdate = Vector(rowCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from ColumnProcessor({}) for Row({}, {})={} ",
+ columnNr,
+ rowNr,
+ rowCellNr,
+ rowUpdate)
rowDetailProcessors(rowNr) ! SudokuDetailProcessor.Update(rowUpdate, detailProcessorResponseMapper)
val (blockNr, blockCellNr) = columnToBlockCoordinates(columnNr, colCellNr)
val blockUpdate = Vector(blockCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from ColumnProcessor({}) for Block({}, {})={} ",
+ columnNr,
+ blockNr,
+ blockCellNr,
+ blockUpdate)
blockDetailProcessors(blockNr) ! SudokuDetailProcessor.Update(blockUpdate, detailProcessorResponseMapper)
}
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(2 * updates.size - 1)
Behaviors.same
case SudokuDetailProcessor.BlockUpdate(blockNr, updates) =>
updates.foreach { (blockCellNr, newCellContent) =>
+ context.log.debug("Incoming update for Block({},{})={} ", blockNr, blockCellNr, newCellContent)
val (rowNr, rowCellNr) = blockToRowCoordinates(blockNr, blockCellNr)
val rowUpdate = Vector(rowCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from BlockProcessor({}) for Row({}, {})={} ",
+ blockNr,
+ rowNr,
+ rowCellNr,
+ rowUpdate)
+
rowDetailProcessors(rowNr) ! SudokuDetailProcessor.Update(rowUpdate, detailProcessorResponseMapper)
val (columnNr, columnCellNr) = blockToColumnCoordinates(blockNr, blockCellNr)
val columnUpdate = Vector(columnCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from BlockProcessor({}) for Column({}, {})={} ",
+ blockNr,
+ columnNr,
+ columnCellNr,
+ columnUpdate)
+
columnDetailProcessors(columnNr) ! SudokuDetailProcessor.Update(
columnUpdate,
detailProcessorResponseMapper)
@@ -125,12 +167,14 @@ class SudokuSolver private (context: ActorContext[SudokuSolver.Command], buffer:
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(2 * updates.size - 1)
Behaviors.same
case unchanged @ SudokuDetailProcessor.SudokuDetailUnchanged =>
+ context.log.debug("SudokuDetailUnchanged")
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(-1)
Behaviors.same
case SudokuProgressTrackerResponseWrapped(result) =>
result match
case SudokuProgressTracker.Result(sudoku) =>
context.log.info(s"Sudoku processing time: ${System.currentTimeMillis() - startTime} milliseconds")
+ context.log.debug("Result: {}", sudoku)
requestor.get ! SudokuSolution(sudoku)
resetAllDetailProcessors()
buffer.unstashAll(idle())
diff --git a/exercises/exercise_008_enum_and_export/build.sbt b/exercises/exercise_008_enum_and_export/build.sbt
index 7dc71f9bc..d104338c1 100644
--- a/exercises/exercise_008_enum_and_export/build.sbt
+++ b/exercises/exercise_008_enum_and_export/build.sbt
@@ -1,12 +1,10 @@
Global / onChangedBuildSource := ReloadOnSourceChanges
-
lazy val `moving-from-scala-2-to-scala-3` =
(project in file(".")).settings(
scalaVersion := "3.3.0",
Compile / scalacOptions ++= CompileOptions.compileOptions,
libraryDependencies ++= Dependencies.dependencies,
- testFrameworks += new TestFramework("munit.Framework"),
- )
+ testFrameworks += new TestFramework("munit.Framework"))
sbt.addCommandAlias("runSolver", "runMain org.lunatechlabs.dotty.SudokuSolverMain")
diff --git a/exercises/exercise_008_enum_and_export/project/Build.scala b/exercises/exercise_008_enum_and_export/project/Build.scala
index ecf13483e..ee8ff2f88 100644
--- a/exercises/exercise_008_enum_and_export/project/Build.scala
+++ b/exercises/exercise_008_enum_and_export/project/Build.scala
@@ -7,43 +7,31 @@ object CompileOptions {
lazy val rewriteNoIndent = Seq("-rewrite", "-noindent")
lazy val rewriteOldSyntax = Seq("-rewrite", "-old-syntax")
- lazy val compileOptions = Seq(
- "-unchecked",
- "-deprecation",
- "-encoding", "UTF-8",
- "-source:future-migration",
- )
+ lazy val compileOptions = Seq("-unchecked", "-deprecation", "-encoding", "UTF-8", "-source:future-migration")
}
object Versions {
- lazy val akkaVer = "2.6.20"
- lazy val logbackVer = "1.2.3"
- lazy val mUnitVer = "0.7.26"
+ lazy val akkaVer = "2.6.20"
+ lazy val logbackVer = "1.2.3"
+ lazy val mUnitVer = "0.7.26"
}
object Dependencies {
private lazy val akkaDeps = Seq(
- "com.typesafe.akka" %% "akka-actor-typed",
- "com.typesafe.akka" %% "akka-slf4j",
- "com.typesafe.akka" %% "akka-stream",
- ).map (_ % Versions.akkaVer)
+ "com.typesafe.akka" %% "akka-actor-typed",
+ "com.typesafe.akka" %% "akka-slf4j",
+ "com.typesafe.akka" %% "akka-stream").map(_ % Versions.akkaVer)
- private lazy val akkaTestkitDeps = Seq(
- "com.typesafe.akka" %% "akka-actor-testkit-typed" % Versions.akkaVer % Test
- )
+ private lazy val akkaTestkitDeps = Seq("com.typesafe.akka" %% "akka-actor-testkit-typed" % Versions.akkaVer % Test)
- private lazy val logbackDeps = Seq (
- "ch.qos.logback" % "logback-classic",
- ).map (_ % Versions.logbackVer)
+ private lazy val logbackDeps = Seq("ch.qos.logback" % "logback-classic").map(_ % Versions.logbackVer)
- private lazy val munitDeps = Seq(
- "org.scalameta" %% "munit" % Versions.mUnitVer % Test
- )
+ private lazy val munitDeps = Seq("org.scalameta" %% "munit" % Versions.mUnitVer % Test)
lazy val dependencies: Seq[ModuleID] =
logbackDeps ++
- munitDeps ++
- akkaDeps ++
- akkaTestkitDeps
+ munitDeps ++
+ akkaDeps ++
+ akkaTestkitDeps
}
diff --git a/exercises/exercise_008_enum_and_export/project/build.properties b/exercises/exercise_008_enum_and_export/project/build.properties
index 72413de15..52413ab79 100644
--- a/exercises/exercise_008_enum_and_export/project/build.properties
+++ b/exercises/exercise_008_enum_and_export/project/build.properties
@@ -1 +1 @@
-sbt.version=1.8.3
+sbt.version=1.9.3
diff --git a/exercises/exercise_008_enum_and_export/src/main/resources/application.conf b/exercises/exercise_008_enum_and_export/src/main/resources/application.conf
index 14927baad..0b5d34e99 100644
--- a/exercises/exercise_008_enum_and_export/src/main/resources/application.conf
+++ b/exercises/exercise_008_enum_and_export/src/main/resources/application.conf
@@ -1,4 +1,8 @@
akka {
+ loggers = ["akka.event.slf4j.Slf4jLogger"]
+ loglevel = "INFO"
+ logging-filter = "akka.event.slf4j.Slf4jLoggingFilter"
+
log-dead-letters = on
logger-startup-timeout = 30s
diff --git a/exercises/exercise_008_enum_and_export/src/main/resources/logback.xml b/exercises/exercise_008_enum_and_export/src/main/resources/logback.xml
index 16cdaa5de..e28eccd9b 100644
--- a/exercises/exercise_008_enum_and_export/src/main/resources/logback.xml
+++ b/exercises/exercise_008_enum_and_export/src/main/resources/logback.xml
@@ -1,24 +1,24 @@
+
-
+
- info
+ INFO
- %date{HH:mm:ss} %-5level [%X{akkaSource}] - %msg%n
+ [%date{ISO8601}] [%level] [%logger] [%marker] [%thread] - %msg %n
-
-
-
-
-
-
-
+
+ target/sudoku.log
+
+ [%date{ISO8601}] [%level] [%logger] [%marker] [%thread] - %msg %n
+
+
-
-
+
+
+
-
diff --git a/exercises/exercise_008_enum_and_export/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuProgressTracker.scala b/exercises/exercise_008_enum_and_export/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuProgressTracker.scala
index 7968e5f84..6fe7711fc 100644
--- a/exercises/exercise_008_enum_and_export/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuProgressTracker.scala
+++ b/exercises/exercise_008_enum_and_export/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuProgressTracker.scala
@@ -32,10 +32,13 @@ class SudokuProgressTracker private (
def trackProgress(updatesInFlight: Int): Behavior[Command] =
Behaviors.receiveMessage {
case NewUpdatesInFlight(updateCount) if updatesInFlight - 1 == 0 =>
+ context.log.debug("NewUpdatesInFlight({}) - UpdatesInFlight={}", updateCount, updatesInFlight + updateCount)
rowDetailProcessors.foreach((_, processor) =>
processor ! SudokuDetailProcessor.GetSudokuDetailState(context.self))
+
collectEndState()
case NewUpdatesInFlight(updateCount) =>
+ context.log.debug("NewUpdatesInFlight({}) - UpdatesInFlight={}", updateCount, updatesInFlight + updateCount)
trackProgress(updatesInFlight + updateCount)
case msg: SudokuDetailState =>
context.log.error("Received unexpected message in state 'trackProgress': {}", msg)
diff --git a/exercises/exercise_008_enum_and_export/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuSolver.scala b/exercises/exercise_008_enum_and_export/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuSolver.scala
index 6a3e8ba13..36858c2b9 100644
--- a/exercises/exercise_008_enum_and_export/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuSolver.scala
+++ b/exercises/exercise_008_enum_and_export/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuSolver.scala
@@ -72,6 +72,7 @@ class SudokuSolver private (context: ActorContext[SudokuSolver.Command], buffer:
rowUpdates.foreach { case SudokuDetailProcessor.RowUpdate(row, cellUpdates) =>
rowDetailProcessors(row) ! SudokuDetailProcessor.Update(cellUpdates, detailProcessorResponseMapper)
}
+ context.log.debug("InitialRowUpdates: {}", rowUpdates)
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(rowUpdates.size)
processRequest(Some(sender), System.currentTimeMillis())
case unexpectedMsg =>
@@ -86,38 +87,79 @@ class SudokuSolver private (context: ActorContext[SudokuSolver.Command], buffer:
response match
case SudokuDetailProcessor.RowUpdate(rowNr, updates) =>
updates.foreach { (rowCellNr, newCellContent) =>
+ context.log.debug("Incoming update for Row({},{})={} ", rowNr, rowCellNr, newCellContent)
val (columnNr, columnCellNr) = rowToColumnCoordinates(rowNr, rowCellNr)
val columnUpdate = Vector(columnCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from RowProcessor({}) for Column({}, {})={} ",
+ rowNr,
+ columnNr,
+ columnCellNr,
+ columnUpdate)
columnDetailProcessors(columnNr) ! SudokuDetailProcessor.Update(
columnUpdate,
detailProcessorResponseMapper)
val (blockNr, blockCellNr) = rowToBlockCoordinates(rowNr, rowCellNr)
val blockUpdate = Vector(blockCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from RowProcessor({}) for Block({}, {})={} ",
+ rowNr,
+ blockNr,
+ blockCellNr,
+ blockUpdate)
blockDetailProcessors(blockNr) ! SudokuDetailProcessor.Update(blockUpdate, detailProcessorResponseMapper)
}
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(2 * updates.size - 1)
Behaviors.same
case SudokuDetailProcessor.ColumnUpdate(columnNr, updates) =>
updates.foreach { (colCellNr, newCellContent) =>
+ context.log.debug("Incoming update for Column({},{})={} ", columnNr, colCellNr, newCellContent)
val (rowNr, rowCellNr) = columnToRowCoordinates(columnNr, colCellNr)
val rowUpdate = Vector(rowCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from ColumnProcessor({}) for Row({}, {})={} ",
+ columnNr,
+ rowNr,
+ rowCellNr,
+ rowUpdate)
rowDetailProcessors(rowNr) ! SudokuDetailProcessor.Update(rowUpdate, detailProcessorResponseMapper)
val (blockNr, blockCellNr) = columnToBlockCoordinates(columnNr, colCellNr)
val blockUpdate = Vector(blockCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from ColumnProcessor({}) for Block({}, {})={} ",
+ columnNr,
+ blockNr,
+ blockCellNr,
+ blockUpdate)
blockDetailProcessors(blockNr) ! SudokuDetailProcessor.Update(blockUpdate, detailProcessorResponseMapper)
}
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(2 * updates.size - 1)
Behaviors.same
case SudokuDetailProcessor.BlockUpdate(blockNr, updates) =>
updates.foreach { (blockCellNr, newCellContent) =>
+ context.log.debug("Incoming update for Block({},{})={} ", blockNr, blockCellNr, newCellContent)
val (rowNr, rowCellNr) = blockToRowCoordinates(blockNr, blockCellNr)
val rowUpdate = Vector(rowCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from BlockProcessor({}) for Row({}, {})={} ",
+ blockNr,
+ rowNr,
+ rowCellNr,
+ rowUpdate)
+
rowDetailProcessors(rowNr) ! SudokuDetailProcessor.Update(rowUpdate, detailProcessorResponseMapper)
val (columnNr, columnCellNr) = blockToColumnCoordinates(blockNr, blockCellNr)
val columnUpdate = Vector(columnCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from BlockProcessor({}) for Column({}, {})={} ",
+ blockNr,
+ columnNr,
+ columnCellNr,
+ columnUpdate)
+
columnDetailProcessors(columnNr) ! SudokuDetailProcessor.Update(
columnUpdate,
detailProcessorResponseMapper)
@@ -125,12 +167,14 @@ class SudokuSolver private (context: ActorContext[SudokuSolver.Command], buffer:
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(2 * updates.size - 1)
Behaviors.same
case unchanged @ SudokuDetailProcessor.SudokuDetailUnchanged =>
+ context.log.debug("SudokuDetailUnchanged")
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(-1)
Behaviors.same
case SudokuProgressTrackerResponseWrapped(result) =>
result match
case SudokuProgressTracker.Result(sudoku) =>
context.log.info(s"Sudoku processing time: ${System.currentTimeMillis() - startTime} milliseconds")
+ context.log.debug("Result: {}", sudoku)
requestor.get ! SudokuSolution(sudoku)
resetAllDetailProcessors()
buffer.unstashAll(idle())
diff --git a/exercises/exercise_009_union_types/build.sbt b/exercises/exercise_009_union_types/build.sbt
index 7dc71f9bc..d104338c1 100644
--- a/exercises/exercise_009_union_types/build.sbt
+++ b/exercises/exercise_009_union_types/build.sbt
@@ -1,12 +1,10 @@
Global / onChangedBuildSource := ReloadOnSourceChanges
-
lazy val `moving-from-scala-2-to-scala-3` =
(project in file(".")).settings(
scalaVersion := "3.3.0",
Compile / scalacOptions ++= CompileOptions.compileOptions,
libraryDependencies ++= Dependencies.dependencies,
- testFrameworks += new TestFramework("munit.Framework"),
- )
+ testFrameworks += new TestFramework("munit.Framework"))
sbt.addCommandAlias("runSolver", "runMain org.lunatechlabs.dotty.SudokuSolverMain")
diff --git a/exercises/exercise_009_union_types/project/Build.scala b/exercises/exercise_009_union_types/project/Build.scala
index ecf13483e..ee8ff2f88 100644
--- a/exercises/exercise_009_union_types/project/Build.scala
+++ b/exercises/exercise_009_union_types/project/Build.scala
@@ -7,43 +7,31 @@ object CompileOptions {
lazy val rewriteNoIndent = Seq("-rewrite", "-noindent")
lazy val rewriteOldSyntax = Seq("-rewrite", "-old-syntax")
- lazy val compileOptions = Seq(
- "-unchecked",
- "-deprecation",
- "-encoding", "UTF-8",
- "-source:future-migration",
- )
+ lazy val compileOptions = Seq("-unchecked", "-deprecation", "-encoding", "UTF-8", "-source:future-migration")
}
object Versions {
- lazy val akkaVer = "2.6.20"
- lazy val logbackVer = "1.2.3"
- lazy val mUnitVer = "0.7.26"
+ lazy val akkaVer = "2.6.20"
+ lazy val logbackVer = "1.2.3"
+ lazy val mUnitVer = "0.7.26"
}
object Dependencies {
private lazy val akkaDeps = Seq(
- "com.typesafe.akka" %% "akka-actor-typed",
- "com.typesafe.akka" %% "akka-slf4j",
- "com.typesafe.akka" %% "akka-stream",
- ).map (_ % Versions.akkaVer)
+ "com.typesafe.akka" %% "akka-actor-typed",
+ "com.typesafe.akka" %% "akka-slf4j",
+ "com.typesafe.akka" %% "akka-stream").map(_ % Versions.akkaVer)
- private lazy val akkaTestkitDeps = Seq(
- "com.typesafe.akka" %% "akka-actor-testkit-typed" % Versions.akkaVer % Test
- )
+ private lazy val akkaTestkitDeps = Seq("com.typesafe.akka" %% "akka-actor-testkit-typed" % Versions.akkaVer % Test)
- private lazy val logbackDeps = Seq (
- "ch.qos.logback" % "logback-classic",
- ).map (_ % Versions.logbackVer)
+ private lazy val logbackDeps = Seq("ch.qos.logback" % "logback-classic").map(_ % Versions.logbackVer)
- private lazy val munitDeps = Seq(
- "org.scalameta" %% "munit" % Versions.mUnitVer % Test
- )
+ private lazy val munitDeps = Seq("org.scalameta" %% "munit" % Versions.mUnitVer % Test)
lazy val dependencies: Seq[ModuleID] =
logbackDeps ++
- munitDeps ++
- akkaDeps ++
- akkaTestkitDeps
+ munitDeps ++
+ akkaDeps ++
+ akkaTestkitDeps
}
diff --git a/exercises/exercise_009_union_types/project/build.properties b/exercises/exercise_009_union_types/project/build.properties
index 72413de15..52413ab79 100644
--- a/exercises/exercise_009_union_types/project/build.properties
+++ b/exercises/exercise_009_union_types/project/build.properties
@@ -1 +1 @@
-sbt.version=1.8.3
+sbt.version=1.9.3
diff --git a/exercises/exercise_009_union_types/src/main/resources/application.conf b/exercises/exercise_009_union_types/src/main/resources/application.conf
index 14927baad..0b5d34e99 100644
--- a/exercises/exercise_009_union_types/src/main/resources/application.conf
+++ b/exercises/exercise_009_union_types/src/main/resources/application.conf
@@ -1,4 +1,8 @@
akka {
+ loggers = ["akka.event.slf4j.Slf4jLogger"]
+ loglevel = "INFO"
+ logging-filter = "akka.event.slf4j.Slf4jLoggingFilter"
+
log-dead-letters = on
logger-startup-timeout = 30s
diff --git a/exercises/exercise_009_union_types/src/main/resources/logback.xml b/exercises/exercise_009_union_types/src/main/resources/logback.xml
index 16cdaa5de..e28eccd9b 100644
--- a/exercises/exercise_009_union_types/src/main/resources/logback.xml
+++ b/exercises/exercise_009_union_types/src/main/resources/logback.xml
@@ -1,24 +1,24 @@
+
-
+
- info
+ INFO
- %date{HH:mm:ss} %-5level [%X{akkaSource}] - %msg%n
+ [%date{ISO8601}] [%level] [%logger] [%marker] [%thread] - %msg %n
-
-
-
-
-
-
-
+
+ target/sudoku.log
+
+ [%date{ISO8601}] [%level] [%logger] [%marker] [%thread] - %msg %n
+
+
-
-
+
+
+
-
diff --git a/exercises/exercise_009_union_types/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuProgressTracker.scala b/exercises/exercise_009_union_types/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuProgressTracker.scala
index 7968e5f84..6fe7711fc 100644
--- a/exercises/exercise_009_union_types/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuProgressTracker.scala
+++ b/exercises/exercise_009_union_types/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuProgressTracker.scala
@@ -32,10 +32,13 @@ class SudokuProgressTracker private (
def trackProgress(updatesInFlight: Int): Behavior[Command] =
Behaviors.receiveMessage {
case NewUpdatesInFlight(updateCount) if updatesInFlight - 1 == 0 =>
+ context.log.debug("NewUpdatesInFlight({}) - UpdatesInFlight={}", updateCount, updatesInFlight + updateCount)
rowDetailProcessors.foreach((_, processor) =>
processor ! SudokuDetailProcessor.GetSudokuDetailState(context.self))
+
collectEndState()
case NewUpdatesInFlight(updateCount) =>
+ context.log.debug("NewUpdatesInFlight({}) - UpdatesInFlight={}", updateCount, updatesInFlight + updateCount)
trackProgress(updatesInFlight + updateCount)
case msg: SudokuDetailState =>
context.log.error("Received unexpected message in state 'trackProgress': {}", msg)
diff --git a/exercises/exercise_009_union_types/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuSolver.scala b/exercises/exercise_009_union_types/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuSolver.scala
index 5aef42003..b3afe3ddf 100644
--- a/exercises/exercise_009_union_types/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuSolver.scala
+++ b/exercises/exercise_009_union_types/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuSolver.scala
@@ -69,6 +69,7 @@ class SudokuSolver private (
rowUpdates.foreach { case SudokuDetailProcessor.RowUpdate(row, cellUpdates) =>
rowDetailProcessors(row) ! SudokuDetailProcessor.Update(cellUpdates, context.self)
}
+ context.log.debug("InitialRowUpdates: {}", rowUpdates)
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(rowUpdates.size)
processRequest(Some(sender), System.currentTimeMillis())
case unexpectedMsg =>
@@ -81,36 +82,75 @@ class SudokuSolver private (
Behaviors.receiveMessage {
case SudokuDetailProcessor.RowUpdate(rowNr, updates) =>
updates.foreach { (rowCellNr, newCellContent) =>
+ context.log.debug("Incoming update for Row({},{})={} ", rowNr, rowCellNr, newCellContent)
val (columnNr, columnCellNr) = rowToColumnCoordinates(rowNr, rowCellNr)
val columnUpdate = Vector(columnCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from RowProcessor({}) for Column({}, {})={} ",
+ rowNr,
+ columnNr,
+ columnCellNr,
+ columnUpdate)
columnDetailProcessors(columnNr) ! SudokuDetailProcessor.Update(columnUpdate, context.self)
val (blockNr, blockCellNr) = rowToBlockCoordinates(rowNr, rowCellNr)
val blockUpdate = Vector(blockCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from RowProcessor({}) for Block({}, {})={} ",
+ rowNr,
+ blockNr,
+ blockCellNr,
+ blockUpdate)
blockDetailProcessors(blockNr) ! SudokuDetailProcessor.Update(blockUpdate, context.self)
}
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(2 * updates.size - 1)
Behaviors.same
case SudokuDetailProcessor.ColumnUpdate(columnNr, updates) =>
updates.foreach { (colCellNr, newCellContent) =>
+ context.log.debug("Incoming update for Column({},{})={} ", columnNr, colCellNr, newCellContent)
val (rowNr, rowCellNr) = columnToRowCoordinates(columnNr, colCellNr)
val rowUpdate = Vector(rowCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from ColumnProcessor({}) for Row({}, {})={} ",
+ columnNr,
+ rowNr,
+ rowCellNr,
+ rowUpdate)
rowDetailProcessors(rowNr) ! SudokuDetailProcessor.Update(rowUpdate, context.self)
val (blockNr, blockCellNr) = columnToBlockCoordinates(columnNr, colCellNr)
val blockUpdate = Vector(blockCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from ColumnProcessor({}) for Block({}, {})={} ",
+ columnNr,
+ blockNr,
+ blockCellNr,
+ blockUpdate)
blockDetailProcessors(blockNr) ! SudokuDetailProcessor.Update(blockUpdate, context.self)
}
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(2 * updates.size - 1)
Behaviors.same
case SudokuDetailProcessor.BlockUpdate(blockNr, updates) =>
updates.foreach { (blockCellNr, newCellContent) =>
+ context.log.debug("Incoming update for Block({},{})={} ", blockNr, blockCellNr, newCellContent)
val (rowNr, rowCellNr) = blockToRowCoordinates(blockNr, blockCellNr)
val rowUpdate = Vector(rowCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from BlockProcessor({}) for Row({}, {})={} ",
+ blockNr,
+ rowNr,
+ rowCellNr,
+ rowUpdate)
rowDetailProcessors(rowNr) ! SudokuDetailProcessor.Update(rowUpdate, context.self)
val (columnNr, columnCellNr) = blockToColumnCoordinates(blockNr, blockCellNr)
val columnUpdate = Vector(columnCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from BlockProcessor({}) for Column({}, {})={} ",
+ blockNr,
+ columnNr,
+ columnCellNr,
+ columnUpdate)
columnDetailProcessors(columnNr) ! SudokuDetailProcessor.Update(columnUpdate, context.self)
}
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(2 * updates.size - 1)
diff --git a/exercises/exercise_010_opaque_type_aliases/build.sbt b/exercises/exercise_010_opaque_type_aliases/build.sbt
index 7dc71f9bc..d104338c1 100644
--- a/exercises/exercise_010_opaque_type_aliases/build.sbt
+++ b/exercises/exercise_010_opaque_type_aliases/build.sbt
@@ -1,12 +1,10 @@
Global / onChangedBuildSource := ReloadOnSourceChanges
-
lazy val `moving-from-scala-2-to-scala-3` =
(project in file(".")).settings(
scalaVersion := "3.3.0",
Compile / scalacOptions ++= CompileOptions.compileOptions,
libraryDependencies ++= Dependencies.dependencies,
- testFrameworks += new TestFramework("munit.Framework"),
- )
+ testFrameworks += new TestFramework("munit.Framework"))
sbt.addCommandAlias("runSolver", "runMain org.lunatechlabs.dotty.SudokuSolverMain")
diff --git a/exercises/exercise_010_opaque_type_aliases/project/Build.scala b/exercises/exercise_010_opaque_type_aliases/project/Build.scala
index ecf13483e..ee8ff2f88 100644
--- a/exercises/exercise_010_opaque_type_aliases/project/Build.scala
+++ b/exercises/exercise_010_opaque_type_aliases/project/Build.scala
@@ -7,43 +7,31 @@ object CompileOptions {
lazy val rewriteNoIndent = Seq("-rewrite", "-noindent")
lazy val rewriteOldSyntax = Seq("-rewrite", "-old-syntax")
- lazy val compileOptions = Seq(
- "-unchecked",
- "-deprecation",
- "-encoding", "UTF-8",
- "-source:future-migration",
- )
+ lazy val compileOptions = Seq("-unchecked", "-deprecation", "-encoding", "UTF-8", "-source:future-migration")
}
object Versions {
- lazy val akkaVer = "2.6.20"
- lazy val logbackVer = "1.2.3"
- lazy val mUnitVer = "0.7.26"
+ lazy val akkaVer = "2.6.20"
+ lazy val logbackVer = "1.2.3"
+ lazy val mUnitVer = "0.7.26"
}
object Dependencies {
private lazy val akkaDeps = Seq(
- "com.typesafe.akka" %% "akka-actor-typed",
- "com.typesafe.akka" %% "akka-slf4j",
- "com.typesafe.akka" %% "akka-stream",
- ).map (_ % Versions.akkaVer)
+ "com.typesafe.akka" %% "akka-actor-typed",
+ "com.typesafe.akka" %% "akka-slf4j",
+ "com.typesafe.akka" %% "akka-stream").map(_ % Versions.akkaVer)
- private lazy val akkaTestkitDeps = Seq(
- "com.typesafe.akka" %% "akka-actor-testkit-typed" % Versions.akkaVer % Test
- )
+ private lazy val akkaTestkitDeps = Seq("com.typesafe.akka" %% "akka-actor-testkit-typed" % Versions.akkaVer % Test)
- private lazy val logbackDeps = Seq (
- "ch.qos.logback" % "logback-classic",
- ).map (_ % Versions.logbackVer)
+ private lazy val logbackDeps = Seq("ch.qos.logback" % "logback-classic").map(_ % Versions.logbackVer)
- private lazy val munitDeps = Seq(
- "org.scalameta" %% "munit" % Versions.mUnitVer % Test
- )
+ private lazy val munitDeps = Seq("org.scalameta" %% "munit" % Versions.mUnitVer % Test)
lazy val dependencies: Seq[ModuleID] =
logbackDeps ++
- munitDeps ++
- akkaDeps ++
- akkaTestkitDeps
+ munitDeps ++
+ akkaDeps ++
+ akkaTestkitDeps
}
diff --git a/exercises/exercise_010_opaque_type_aliases/project/build.properties b/exercises/exercise_010_opaque_type_aliases/project/build.properties
index 72413de15..52413ab79 100644
--- a/exercises/exercise_010_opaque_type_aliases/project/build.properties
+++ b/exercises/exercise_010_opaque_type_aliases/project/build.properties
@@ -1 +1 @@
-sbt.version=1.8.3
+sbt.version=1.9.3
diff --git a/exercises/exercise_010_opaque_type_aliases/src/main/resources/application.conf b/exercises/exercise_010_opaque_type_aliases/src/main/resources/application.conf
index 14927baad..0b5d34e99 100644
--- a/exercises/exercise_010_opaque_type_aliases/src/main/resources/application.conf
+++ b/exercises/exercise_010_opaque_type_aliases/src/main/resources/application.conf
@@ -1,4 +1,8 @@
akka {
+ loggers = ["akka.event.slf4j.Slf4jLogger"]
+ loglevel = "INFO"
+ logging-filter = "akka.event.slf4j.Slf4jLoggingFilter"
+
log-dead-letters = on
logger-startup-timeout = 30s
diff --git a/exercises/exercise_010_opaque_type_aliases/src/main/resources/logback.xml b/exercises/exercise_010_opaque_type_aliases/src/main/resources/logback.xml
index 16cdaa5de..e28eccd9b 100644
--- a/exercises/exercise_010_opaque_type_aliases/src/main/resources/logback.xml
+++ b/exercises/exercise_010_opaque_type_aliases/src/main/resources/logback.xml
@@ -1,24 +1,24 @@
+
-
+
- info
+ INFO
- %date{HH:mm:ss} %-5level [%X{akkaSource}] - %msg%n
+ [%date{ISO8601}] [%level] [%logger] [%marker] [%thread] - %msg %n
-
-
-
-
-
-
-
+
+ target/sudoku.log
+
+ [%date{ISO8601}] [%level] [%logger] [%marker] [%thread] - %msg %n
+
+
-
-
+
+
+
-
diff --git a/exercises/exercise_010_opaque_type_aliases/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuProgressTracker.scala b/exercises/exercise_010_opaque_type_aliases/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuProgressTracker.scala
index 7968e5f84..6fe7711fc 100644
--- a/exercises/exercise_010_opaque_type_aliases/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuProgressTracker.scala
+++ b/exercises/exercise_010_opaque_type_aliases/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuProgressTracker.scala
@@ -32,10 +32,13 @@ class SudokuProgressTracker private (
def trackProgress(updatesInFlight: Int): Behavior[Command] =
Behaviors.receiveMessage {
case NewUpdatesInFlight(updateCount) if updatesInFlight - 1 == 0 =>
+ context.log.debug("NewUpdatesInFlight({}) - UpdatesInFlight={}", updateCount, updatesInFlight + updateCount)
rowDetailProcessors.foreach((_, processor) =>
processor ! SudokuDetailProcessor.GetSudokuDetailState(context.self))
+
collectEndState()
case NewUpdatesInFlight(updateCount) =>
+ context.log.debug("NewUpdatesInFlight({}) - UpdatesInFlight={}", updateCount, updatesInFlight + updateCount)
trackProgress(updatesInFlight + updateCount)
case msg: SudokuDetailState =>
context.log.error("Received unexpected message in state 'trackProgress': {}", msg)
diff --git a/exercises/exercise_010_opaque_type_aliases/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuSolver.scala b/exercises/exercise_010_opaque_type_aliases/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuSolver.scala
index 5aef42003..b3afe3ddf 100644
--- a/exercises/exercise_010_opaque_type_aliases/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuSolver.scala
+++ b/exercises/exercise_010_opaque_type_aliases/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuSolver.scala
@@ -69,6 +69,7 @@ class SudokuSolver private (
rowUpdates.foreach { case SudokuDetailProcessor.RowUpdate(row, cellUpdates) =>
rowDetailProcessors(row) ! SudokuDetailProcessor.Update(cellUpdates, context.self)
}
+ context.log.debug("InitialRowUpdates: {}", rowUpdates)
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(rowUpdates.size)
processRequest(Some(sender), System.currentTimeMillis())
case unexpectedMsg =>
@@ -81,36 +82,75 @@ class SudokuSolver private (
Behaviors.receiveMessage {
case SudokuDetailProcessor.RowUpdate(rowNr, updates) =>
updates.foreach { (rowCellNr, newCellContent) =>
+ context.log.debug("Incoming update for Row({},{})={} ", rowNr, rowCellNr, newCellContent)
val (columnNr, columnCellNr) = rowToColumnCoordinates(rowNr, rowCellNr)
val columnUpdate = Vector(columnCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from RowProcessor({}) for Column({}, {})={} ",
+ rowNr,
+ columnNr,
+ columnCellNr,
+ columnUpdate)
columnDetailProcessors(columnNr) ! SudokuDetailProcessor.Update(columnUpdate, context.self)
val (blockNr, blockCellNr) = rowToBlockCoordinates(rowNr, rowCellNr)
val blockUpdate = Vector(blockCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from RowProcessor({}) for Block({}, {})={} ",
+ rowNr,
+ blockNr,
+ blockCellNr,
+ blockUpdate)
blockDetailProcessors(blockNr) ! SudokuDetailProcessor.Update(blockUpdate, context.self)
}
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(2 * updates.size - 1)
Behaviors.same
case SudokuDetailProcessor.ColumnUpdate(columnNr, updates) =>
updates.foreach { (colCellNr, newCellContent) =>
+ context.log.debug("Incoming update for Column({},{})={} ", columnNr, colCellNr, newCellContent)
val (rowNr, rowCellNr) = columnToRowCoordinates(columnNr, colCellNr)
val rowUpdate = Vector(rowCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from ColumnProcessor({}) for Row({}, {})={} ",
+ columnNr,
+ rowNr,
+ rowCellNr,
+ rowUpdate)
rowDetailProcessors(rowNr) ! SudokuDetailProcessor.Update(rowUpdate, context.self)
val (blockNr, blockCellNr) = columnToBlockCoordinates(columnNr, colCellNr)
val blockUpdate = Vector(blockCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from ColumnProcessor({}) for Block({}, {})={} ",
+ columnNr,
+ blockNr,
+ blockCellNr,
+ blockUpdate)
blockDetailProcessors(blockNr) ! SudokuDetailProcessor.Update(blockUpdate, context.self)
}
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(2 * updates.size - 1)
Behaviors.same
case SudokuDetailProcessor.BlockUpdate(blockNr, updates) =>
updates.foreach { (blockCellNr, newCellContent) =>
+ context.log.debug("Incoming update for Block({},{})={} ", blockNr, blockCellNr, newCellContent)
val (rowNr, rowCellNr) = blockToRowCoordinates(blockNr, blockCellNr)
val rowUpdate = Vector(rowCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from BlockProcessor({}) for Row({}, {})={} ",
+ blockNr,
+ rowNr,
+ rowCellNr,
+ rowUpdate)
rowDetailProcessors(rowNr) ! SudokuDetailProcessor.Update(rowUpdate, context.self)
val (columnNr, columnCellNr) = blockToColumnCoordinates(blockNr, blockCellNr)
val columnUpdate = Vector(columnCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from BlockProcessor({}) for Column({}, {})={} ",
+ blockNr,
+ columnNr,
+ columnCellNr,
+ columnUpdate)
columnDetailProcessors(columnNr) ! SudokuDetailProcessor.Update(columnUpdate, context.self)
}
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(2 * updates.size - 1)
diff --git a/exercises/exercise_011_multiversal_equality/build.sbt b/exercises/exercise_011_multiversal_equality/build.sbt
index 7dc71f9bc..d104338c1 100644
--- a/exercises/exercise_011_multiversal_equality/build.sbt
+++ b/exercises/exercise_011_multiversal_equality/build.sbt
@@ -1,12 +1,10 @@
Global / onChangedBuildSource := ReloadOnSourceChanges
-
lazy val `moving-from-scala-2-to-scala-3` =
(project in file(".")).settings(
scalaVersion := "3.3.0",
Compile / scalacOptions ++= CompileOptions.compileOptions,
libraryDependencies ++= Dependencies.dependencies,
- testFrameworks += new TestFramework("munit.Framework"),
- )
+ testFrameworks += new TestFramework("munit.Framework"))
sbt.addCommandAlias("runSolver", "runMain org.lunatechlabs.dotty.SudokuSolverMain")
diff --git a/exercises/exercise_011_multiversal_equality/project/Build.scala b/exercises/exercise_011_multiversal_equality/project/Build.scala
index 81e97095d..6cad99625 100644
--- a/exercises/exercise_011_multiversal_equality/project/Build.scala
+++ b/exercises/exercise_011_multiversal_equality/project/Build.scala
@@ -7,44 +7,32 @@ object CompileOptions {
lazy val rewriteNoIndent = Seq("-rewrite", "-noindent")
lazy val rewriteOldSyntax = Seq("-rewrite", "-old-syntax")
- lazy val compileOptions = Seq(
- "-unchecked",
- "-deprecation",
- "-encoding", "UTF-8",
- "-source:future-migration",
- "-language:strictEquality",
- )
+ lazy val compileOptions =
+ Seq("-unchecked", "-deprecation", "-encoding", "UTF-8", "-source:future-migration", "-language:strictEquality")
}
object Versions {
- lazy val akkaVer = "2.6.20"
- lazy val logbackVer = "1.2.3"
- lazy val mUnitVer = "0.7.26"
+ lazy val akkaVer = "2.6.20"
+ lazy val logbackVer = "1.2.3"
+ lazy val mUnitVer = "0.7.26"
}
object Dependencies {
private lazy val akkaDeps = Seq(
- "com.typesafe.akka" %% "akka-actor-typed",
- "com.typesafe.akka" %% "akka-slf4j",
- "com.typesafe.akka" %% "akka-stream",
- ).map (_ % Versions.akkaVer)
+ "com.typesafe.akka" %% "akka-actor-typed",
+ "com.typesafe.akka" %% "akka-slf4j",
+ "com.typesafe.akka" %% "akka-stream").map(_ % Versions.akkaVer)
- private lazy val akkaTestkitDeps = Seq(
- "com.typesafe.akka" %% "akka-actor-testkit-typed" % Versions.akkaVer % Test
- )
+ private lazy val akkaTestkitDeps = Seq("com.typesafe.akka" %% "akka-actor-testkit-typed" % Versions.akkaVer % Test)
- private lazy val logbackDeps = Seq (
- "ch.qos.logback" % "logback-classic",
- ).map (_ % Versions.logbackVer)
+ private lazy val logbackDeps = Seq("ch.qos.logback" % "logback-classic").map(_ % Versions.logbackVer)
- private lazy val munitDeps = Seq(
- "org.scalameta" %% "munit" % Versions.mUnitVer % Test
- )
+ private lazy val munitDeps = Seq("org.scalameta" %% "munit" % Versions.mUnitVer % Test)
lazy val dependencies: Seq[ModuleID] =
logbackDeps ++
- munitDeps ++
- akkaDeps ++
- akkaTestkitDeps
+ munitDeps ++
+ akkaDeps ++
+ akkaTestkitDeps
}
diff --git a/exercises/exercise_011_multiversal_equality/project/build.properties b/exercises/exercise_011_multiversal_equality/project/build.properties
index 72413de15..52413ab79 100644
--- a/exercises/exercise_011_multiversal_equality/project/build.properties
+++ b/exercises/exercise_011_multiversal_equality/project/build.properties
@@ -1 +1 @@
-sbt.version=1.8.3
+sbt.version=1.9.3
diff --git a/exercises/exercise_011_multiversal_equality/src/main/resources/application.conf b/exercises/exercise_011_multiversal_equality/src/main/resources/application.conf
index 14927baad..0b5d34e99 100644
--- a/exercises/exercise_011_multiversal_equality/src/main/resources/application.conf
+++ b/exercises/exercise_011_multiversal_equality/src/main/resources/application.conf
@@ -1,4 +1,8 @@
akka {
+ loggers = ["akka.event.slf4j.Slf4jLogger"]
+ loglevel = "INFO"
+ logging-filter = "akka.event.slf4j.Slf4jLoggingFilter"
+
log-dead-letters = on
logger-startup-timeout = 30s
diff --git a/exercises/exercise_011_multiversal_equality/src/main/resources/logback.xml b/exercises/exercise_011_multiversal_equality/src/main/resources/logback.xml
index 16cdaa5de..e28eccd9b 100644
--- a/exercises/exercise_011_multiversal_equality/src/main/resources/logback.xml
+++ b/exercises/exercise_011_multiversal_equality/src/main/resources/logback.xml
@@ -1,24 +1,24 @@
+
-
+
- info
+ INFO
- %date{HH:mm:ss} %-5level [%X{akkaSource}] - %msg%n
+ [%date{ISO8601}] [%level] [%logger] [%marker] [%thread] - %msg %n
-
-
-
-
-
-
-
+
+ target/sudoku.log
+
+ [%date{ISO8601}] [%level] [%logger] [%marker] [%thread] - %msg %n
+
+
-
-
+
+
+
-
diff --git a/exercises/exercise_011_multiversal_equality/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuProgressTracker.scala b/exercises/exercise_011_multiversal_equality/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuProgressTracker.scala
index 7968e5f84..6fe7711fc 100644
--- a/exercises/exercise_011_multiversal_equality/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuProgressTracker.scala
+++ b/exercises/exercise_011_multiversal_equality/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuProgressTracker.scala
@@ -32,10 +32,13 @@ class SudokuProgressTracker private (
def trackProgress(updatesInFlight: Int): Behavior[Command] =
Behaviors.receiveMessage {
case NewUpdatesInFlight(updateCount) if updatesInFlight - 1 == 0 =>
+ context.log.debug("NewUpdatesInFlight({}) - UpdatesInFlight={}", updateCount, updatesInFlight + updateCount)
rowDetailProcessors.foreach((_, processor) =>
processor ! SudokuDetailProcessor.GetSudokuDetailState(context.self))
+
collectEndState()
case NewUpdatesInFlight(updateCount) =>
+ context.log.debug("NewUpdatesInFlight({}) - UpdatesInFlight={}", updateCount, updatesInFlight + updateCount)
trackProgress(updatesInFlight + updateCount)
case msg: SudokuDetailState =>
context.log.error("Received unexpected message in state 'trackProgress': {}", msg)
diff --git a/exercises/exercise_011_multiversal_equality/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuSolver.scala b/exercises/exercise_011_multiversal_equality/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuSolver.scala
index 6c1801d4c..ac1431fd6 100644
--- a/exercises/exercise_011_multiversal_equality/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuSolver.scala
+++ b/exercises/exercise_011_multiversal_equality/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuSolver.scala
@@ -71,6 +71,7 @@ class SudokuSolver private (
rowUpdates.foreach { case SudokuDetailProcessor.RowUpdate(row, cellUpdates) =>
rowDetailProcessors(row) ! SudokuDetailProcessor.Update(cellUpdates, context.self)
}
+ context.log.debug("InitialRowUpdates: {}", rowUpdates)
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(rowUpdates.size)
processRequest(Some(sender), System.currentTimeMillis())
case unexpectedMsg =>
@@ -83,36 +84,75 @@ class SudokuSolver private (
Behaviors.receiveMessage {
case SudokuDetailProcessor.RowUpdate(rowNr, updates) =>
updates.foreach { (rowCellNr, newCellContent) =>
+ context.log.debug("Incoming update for Row({},{})={} ", rowNr, rowCellNr, newCellContent)
val (columnNr, columnCellNr) = rowToColumnCoordinates(rowNr, rowCellNr)
val columnUpdate = Vector(columnCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from RowProcessor({}) for Column({}, {})={} ",
+ rowNr,
+ columnNr,
+ columnCellNr,
+ columnUpdate)
columnDetailProcessors(columnNr) ! SudokuDetailProcessor.Update(columnUpdate, context.self)
val (blockNr, blockCellNr) = rowToBlockCoordinates(rowNr, rowCellNr)
val blockUpdate = Vector(blockCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from RowProcessor({}) for Block({}, {})={} ",
+ rowNr,
+ blockNr,
+ blockCellNr,
+ blockUpdate)
blockDetailProcessors(blockNr) ! SudokuDetailProcessor.Update(blockUpdate, context.self)
}
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(2 * updates.size - 1)
Behaviors.same
case SudokuDetailProcessor.ColumnUpdate(columnNr, updates) =>
updates.foreach { (colCellNr, newCellContent) =>
+ context.log.debug("Incoming update for Column({},{})={} ", columnNr, colCellNr, newCellContent)
val (rowNr, rowCellNr) = columnToRowCoordinates(columnNr, colCellNr)
val rowUpdate = Vector(rowCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from ColumnProcessor({}) for Row({}, {})={} ",
+ columnNr,
+ rowNr,
+ rowCellNr,
+ rowUpdate)
rowDetailProcessors(rowNr) ! SudokuDetailProcessor.Update(rowUpdate, context.self)
val (blockNr, blockCellNr) = columnToBlockCoordinates(columnNr, colCellNr)
val blockUpdate = Vector(blockCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from ColumnProcessor({}) for Block({}, {})={} ",
+ columnNr,
+ blockNr,
+ blockCellNr,
+ blockUpdate)
blockDetailProcessors(blockNr) ! SudokuDetailProcessor.Update(blockUpdate, context.self)
}
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(2 * updates.size - 1)
Behaviors.same
case SudokuDetailProcessor.BlockUpdate(blockNr, updates) =>
updates.foreach { (blockCellNr, newCellContent) =>
+ context.log.debug("Incoming update for Block({},{})={} ", blockNr, blockCellNr, newCellContent)
val (rowNr, rowCellNr) = blockToRowCoordinates(blockNr, blockCellNr)
val rowUpdate = Vector(rowCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from BlockProcessor({}) for Row({}, {})={} ",
+ blockNr,
+ rowNr,
+ rowCellNr,
+ rowUpdate)
rowDetailProcessors(rowNr) ! SudokuDetailProcessor.Update(rowUpdate, context.self)
val (columnNr, columnCellNr) = blockToColumnCoordinates(blockNr, blockCellNr)
val columnUpdate = Vector(columnCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from BlockProcessor({}) for Column({}, {})={} ",
+ blockNr,
+ columnNr,
+ columnCellNr,
+ columnUpdate)
columnDetailProcessors(columnNr) ! SudokuDetailProcessor.Update(columnUpdate, context.self)
}
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(2 * updates.size - 1)
diff --git a/exercises/exercise_020_opaque_type_aliases_alt/build.sbt b/exercises/exercise_020_opaque_type_aliases_alt/build.sbt
index 7dc71f9bc..d104338c1 100644
--- a/exercises/exercise_020_opaque_type_aliases_alt/build.sbt
+++ b/exercises/exercise_020_opaque_type_aliases_alt/build.sbt
@@ -1,12 +1,10 @@
Global / onChangedBuildSource := ReloadOnSourceChanges
-
lazy val `moving-from-scala-2-to-scala-3` =
(project in file(".")).settings(
scalaVersion := "3.3.0",
Compile / scalacOptions ++= CompileOptions.compileOptions,
libraryDependencies ++= Dependencies.dependencies,
- testFrameworks += new TestFramework("munit.Framework"),
- )
+ testFrameworks += new TestFramework("munit.Framework"))
sbt.addCommandAlias("runSolver", "runMain org.lunatechlabs.dotty.SudokuSolverMain")
diff --git a/exercises/exercise_020_opaque_type_aliases_alt/project/Build.scala b/exercises/exercise_020_opaque_type_aliases_alt/project/Build.scala
index ecf13483e..ee8ff2f88 100644
--- a/exercises/exercise_020_opaque_type_aliases_alt/project/Build.scala
+++ b/exercises/exercise_020_opaque_type_aliases_alt/project/Build.scala
@@ -7,43 +7,31 @@ object CompileOptions {
lazy val rewriteNoIndent = Seq("-rewrite", "-noindent")
lazy val rewriteOldSyntax = Seq("-rewrite", "-old-syntax")
- lazy val compileOptions = Seq(
- "-unchecked",
- "-deprecation",
- "-encoding", "UTF-8",
- "-source:future-migration",
- )
+ lazy val compileOptions = Seq("-unchecked", "-deprecation", "-encoding", "UTF-8", "-source:future-migration")
}
object Versions {
- lazy val akkaVer = "2.6.20"
- lazy val logbackVer = "1.2.3"
- lazy val mUnitVer = "0.7.26"
+ lazy val akkaVer = "2.6.20"
+ lazy val logbackVer = "1.2.3"
+ lazy val mUnitVer = "0.7.26"
}
object Dependencies {
private lazy val akkaDeps = Seq(
- "com.typesafe.akka" %% "akka-actor-typed",
- "com.typesafe.akka" %% "akka-slf4j",
- "com.typesafe.akka" %% "akka-stream",
- ).map (_ % Versions.akkaVer)
+ "com.typesafe.akka" %% "akka-actor-typed",
+ "com.typesafe.akka" %% "akka-slf4j",
+ "com.typesafe.akka" %% "akka-stream").map(_ % Versions.akkaVer)
- private lazy val akkaTestkitDeps = Seq(
- "com.typesafe.akka" %% "akka-actor-testkit-typed" % Versions.akkaVer % Test
- )
+ private lazy val akkaTestkitDeps = Seq("com.typesafe.akka" %% "akka-actor-testkit-typed" % Versions.akkaVer % Test)
- private lazy val logbackDeps = Seq (
- "ch.qos.logback" % "logback-classic",
- ).map (_ % Versions.logbackVer)
+ private lazy val logbackDeps = Seq("ch.qos.logback" % "logback-classic").map(_ % Versions.logbackVer)
- private lazy val munitDeps = Seq(
- "org.scalameta" %% "munit" % Versions.mUnitVer % Test
- )
+ private lazy val munitDeps = Seq("org.scalameta" %% "munit" % Versions.mUnitVer % Test)
lazy val dependencies: Seq[ModuleID] =
logbackDeps ++
- munitDeps ++
- akkaDeps ++
- akkaTestkitDeps
+ munitDeps ++
+ akkaDeps ++
+ akkaTestkitDeps
}
diff --git a/exercises/exercise_020_opaque_type_aliases_alt/project/build.properties b/exercises/exercise_020_opaque_type_aliases_alt/project/build.properties
index 72413de15..52413ab79 100644
--- a/exercises/exercise_020_opaque_type_aliases_alt/project/build.properties
+++ b/exercises/exercise_020_opaque_type_aliases_alt/project/build.properties
@@ -1 +1 @@
-sbt.version=1.8.3
+sbt.version=1.9.3
diff --git a/exercises/exercise_020_opaque_type_aliases_alt/src/main/resources/application.conf b/exercises/exercise_020_opaque_type_aliases_alt/src/main/resources/application.conf
index 14927baad..0b5d34e99 100644
--- a/exercises/exercise_020_opaque_type_aliases_alt/src/main/resources/application.conf
+++ b/exercises/exercise_020_opaque_type_aliases_alt/src/main/resources/application.conf
@@ -1,4 +1,8 @@
akka {
+ loggers = ["akka.event.slf4j.Slf4jLogger"]
+ loglevel = "INFO"
+ logging-filter = "akka.event.slf4j.Slf4jLoggingFilter"
+
log-dead-letters = on
logger-startup-timeout = 30s
diff --git a/exercises/exercise_020_opaque_type_aliases_alt/src/main/resources/logback.xml b/exercises/exercise_020_opaque_type_aliases_alt/src/main/resources/logback.xml
index 16cdaa5de..e28eccd9b 100644
--- a/exercises/exercise_020_opaque_type_aliases_alt/src/main/resources/logback.xml
+++ b/exercises/exercise_020_opaque_type_aliases_alt/src/main/resources/logback.xml
@@ -1,24 +1,24 @@
+
-
+
- info
+ INFO
- %date{HH:mm:ss} %-5level [%X{akkaSource}] - %msg%n
+ [%date{ISO8601}] [%level] [%logger] [%marker] [%thread] - %msg %n
-
-
-
-
-
-
-
+
+ target/sudoku.log
+
+ [%date{ISO8601}] [%level] [%logger] [%marker] [%thread] - %msg %n
+
+
-
-
+
+
+
-
diff --git a/exercises/exercise_020_opaque_type_aliases_alt/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuProgressTracker.scala b/exercises/exercise_020_opaque_type_aliases_alt/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuProgressTracker.scala
index 7968e5f84..6fe7711fc 100644
--- a/exercises/exercise_020_opaque_type_aliases_alt/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuProgressTracker.scala
+++ b/exercises/exercise_020_opaque_type_aliases_alt/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuProgressTracker.scala
@@ -32,10 +32,13 @@ class SudokuProgressTracker private (
def trackProgress(updatesInFlight: Int): Behavior[Command] =
Behaviors.receiveMessage {
case NewUpdatesInFlight(updateCount) if updatesInFlight - 1 == 0 =>
+ context.log.debug("NewUpdatesInFlight({}) - UpdatesInFlight={}", updateCount, updatesInFlight + updateCount)
rowDetailProcessors.foreach((_, processor) =>
processor ! SudokuDetailProcessor.GetSudokuDetailState(context.self))
+
collectEndState()
case NewUpdatesInFlight(updateCount) =>
+ context.log.debug("NewUpdatesInFlight({}) - UpdatesInFlight={}", updateCount, updatesInFlight + updateCount)
trackProgress(updatesInFlight + updateCount)
case msg: SudokuDetailState =>
context.log.error("Received unexpected message in state 'trackProgress': {}", msg)
diff --git a/exercises/exercise_020_opaque_type_aliases_alt/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuSolver.scala b/exercises/exercise_020_opaque_type_aliases_alt/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuSolver.scala
index 50c4f28cb..7f24e73e6 100644
--- a/exercises/exercise_020_opaque_type_aliases_alt/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuSolver.scala
+++ b/exercises/exercise_020_opaque_type_aliases_alt/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuSolver.scala
@@ -69,6 +69,7 @@ class SudokuSolver private (
rowUpdates.foreach { case SudokuDetailProcessor.RowUpdate(row, cellUpdates) =>
rowDetailProcessors(row) ! SudokuDetailProcessor.Update(cellUpdates, context.self)
}
+ context.log.debug("InitialRowUpdates: {}", rowUpdates)
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(rowUpdates.size)
processRequest(Some(sender), System.currentTimeMillis())
case unexpectedMsg =>
@@ -81,36 +82,75 @@ class SudokuSolver private (
Behaviors.receiveMessage {
case SudokuDetailProcessor.RowUpdate(rowNr, updates) =>
updates.foreach { (rowCellNr, newCellContent) =>
+ context.log.debug("Incoming update for Row({},{})={} ", rowNr, rowCellNr, newCellContent)
val (columnNr, columnCellNr) = rowToColumnCoordinates(rowNr, rowCellNr)
val columnUpdate = CellUpdates(columnCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from RowProcessor({}) for Column({}, {})={} ",
+ rowNr,
+ columnNr,
+ columnCellNr,
+ columnUpdate)
columnDetailProcessors(columnNr) ! SudokuDetailProcessor.Update(columnUpdate, context.self)
val (blockNr, blockCellNr) = rowToBlockCoordinates(rowNr, rowCellNr)
val blockUpdate = CellUpdates(blockCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from RowProcessor({}) for Block({}, {})={} ",
+ rowNr,
+ blockNr,
+ blockCellNr,
+ blockUpdate)
blockDetailProcessors(blockNr) ! SudokuDetailProcessor.Update(blockUpdate, context.self)
}
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(2 * updates.size - 1)
Behaviors.same
case SudokuDetailProcessor.ColumnUpdate(columnNr, updates) =>
updates.foreach { (colCellNr, newCellContent) =>
+ context.log.debug("Incoming update for Column({},{})={} ", columnNr, colCellNr, newCellContent)
val (rowNr, rowCellNr) = columnToRowCoordinates(columnNr, colCellNr)
val rowUpdate = CellUpdates(rowCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from ColumnProcessor({}) for Row({}, {})={} ",
+ columnNr,
+ rowNr,
+ rowCellNr,
+ rowUpdate)
rowDetailProcessors(rowNr) ! SudokuDetailProcessor.Update(rowUpdate, context.self)
val (blockNr, blockCellNr) = columnToBlockCoordinates(columnNr, colCellNr)
val blockUpdate = CellUpdates(blockCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from ColumnProcessor({}) for Block({}, {})={} ",
+ columnNr,
+ blockNr,
+ blockCellNr,
+ blockUpdate)
blockDetailProcessors(blockNr) ! SudokuDetailProcessor.Update(blockUpdate, context.self)
}
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(2 * updates.size - 1)
Behaviors.same
case SudokuDetailProcessor.BlockUpdate(blockNr, updates) =>
updates.foreach { (blockCellNr, newCellContent) =>
+ context.log.debug("Incoming update for Block({},{})={} ", blockNr, blockCellNr, newCellContent)
val (rowNr, rowCellNr) = blockToRowCoordinates(blockNr, blockCellNr)
val rowUpdate = CellUpdates(rowCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from BlockProcessor({}) for Row({}, {})={} ",
+ blockNr,
+ rowNr,
+ rowCellNr,
+ rowUpdate)
rowDetailProcessors(rowNr) ! SudokuDetailProcessor.Update(rowUpdate, context.self)
val (columnNr, columnCellNr) = blockToColumnCoordinates(blockNr, blockCellNr)
val columnUpdate = CellUpdates(columnCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from BlockProcessor({}) for Column({}, {})={} ",
+ blockNr,
+ columnNr,
+ columnCellNr,
+ columnUpdate)
columnDetailProcessors(columnNr) ! SudokuDetailProcessor.Update(columnUpdate, context.self)
}
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(2 * updates.size - 1)
diff --git a/exercises/exercise_021_multiversal_equality/build.sbt b/exercises/exercise_021_multiversal_equality/build.sbt
index 7dc71f9bc..d104338c1 100644
--- a/exercises/exercise_021_multiversal_equality/build.sbt
+++ b/exercises/exercise_021_multiversal_equality/build.sbt
@@ -1,12 +1,10 @@
Global / onChangedBuildSource := ReloadOnSourceChanges
-
lazy val `moving-from-scala-2-to-scala-3` =
(project in file(".")).settings(
scalaVersion := "3.3.0",
Compile / scalacOptions ++= CompileOptions.compileOptions,
libraryDependencies ++= Dependencies.dependencies,
- testFrameworks += new TestFramework("munit.Framework"),
- )
+ testFrameworks += new TestFramework("munit.Framework"))
sbt.addCommandAlias("runSolver", "runMain org.lunatechlabs.dotty.SudokuSolverMain")
diff --git a/exercises/exercise_021_multiversal_equality/project/Build.scala b/exercises/exercise_021_multiversal_equality/project/Build.scala
index 81e97095d..6cad99625 100644
--- a/exercises/exercise_021_multiversal_equality/project/Build.scala
+++ b/exercises/exercise_021_multiversal_equality/project/Build.scala
@@ -7,44 +7,32 @@ object CompileOptions {
lazy val rewriteNoIndent = Seq("-rewrite", "-noindent")
lazy val rewriteOldSyntax = Seq("-rewrite", "-old-syntax")
- lazy val compileOptions = Seq(
- "-unchecked",
- "-deprecation",
- "-encoding", "UTF-8",
- "-source:future-migration",
- "-language:strictEquality",
- )
+ lazy val compileOptions =
+ Seq("-unchecked", "-deprecation", "-encoding", "UTF-8", "-source:future-migration", "-language:strictEquality")
}
object Versions {
- lazy val akkaVer = "2.6.20"
- lazy val logbackVer = "1.2.3"
- lazy val mUnitVer = "0.7.26"
+ lazy val akkaVer = "2.6.20"
+ lazy val logbackVer = "1.2.3"
+ lazy val mUnitVer = "0.7.26"
}
object Dependencies {
private lazy val akkaDeps = Seq(
- "com.typesafe.akka" %% "akka-actor-typed",
- "com.typesafe.akka" %% "akka-slf4j",
- "com.typesafe.akka" %% "akka-stream",
- ).map (_ % Versions.akkaVer)
+ "com.typesafe.akka" %% "akka-actor-typed",
+ "com.typesafe.akka" %% "akka-slf4j",
+ "com.typesafe.akka" %% "akka-stream").map(_ % Versions.akkaVer)
- private lazy val akkaTestkitDeps = Seq(
- "com.typesafe.akka" %% "akka-actor-testkit-typed" % Versions.akkaVer % Test
- )
+ private lazy val akkaTestkitDeps = Seq("com.typesafe.akka" %% "akka-actor-testkit-typed" % Versions.akkaVer % Test)
- private lazy val logbackDeps = Seq (
- "ch.qos.logback" % "logback-classic",
- ).map (_ % Versions.logbackVer)
+ private lazy val logbackDeps = Seq("ch.qos.logback" % "logback-classic").map(_ % Versions.logbackVer)
- private lazy val munitDeps = Seq(
- "org.scalameta" %% "munit" % Versions.mUnitVer % Test
- )
+ private lazy val munitDeps = Seq("org.scalameta" %% "munit" % Versions.mUnitVer % Test)
lazy val dependencies: Seq[ModuleID] =
logbackDeps ++
- munitDeps ++
- akkaDeps ++
- akkaTestkitDeps
+ munitDeps ++
+ akkaDeps ++
+ akkaTestkitDeps
}
diff --git a/exercises/exercise_021_multiversal_equality/project/build.properties b/exercises/exercise_021_multiversal_equality/project/build.properties
index 72413de15..52413ab79 100644
--- a/exercises/exercise_021_multiversal_equality/project/build.properties
+++ b/exercises/exercise_021_multiversal_equality/project/build.properties
@@ -1 +1 @@
-sbt.version=1.8.3
+sbt.version=1.9.3
diff --git a/exercises/exercise_021_multiversal_equality/src/main/resources/application.conf b/exercises/exercise_021_multiversal_equality/src/main/resources/application.conf
index 14927baad..0b5d34e99 100644
--- a/exercises/exercise_021_multiversal_equality/src/main/resources/application.conf
+++ b/exercises/exercise_021_multiversal_equality/src/main/resources/application.conf
@@ -1,4 +1,8 @@
akka {
+ loggers = ["akka.event.slf4j.Slf4jLogger"]
+ loglevel = "INFO"
+ logging-filter = "akka.event.slf4j.Slf4jLoggingFilter"
+
log-dead-letters = on
logger-startup-timeout = 30s
diff --git a/exercises/exercise_021_multiversal_equality/src/main/resources/logback.xml b/exercises/exercise_021_multiversal_equality/src/main/resources/logback.xml
index 16cdaa5de..e28eccd9b 100644
--- a/exercises/exercise_021_multiversal_equality/src/main/resources/logback.xml
+++ b/exercises/exercise_021_multiversal_equality/src/main/resources/logback.xml
@@ -1,24 +1,24 @@
+
-
+
- info
+ INFO
- %date{HH:mm:ss} %-5level [%X{akkaSource}] - %msg%n
+ [%date{ISO8601}] [%level] [%logger] [%marker] [%thread] - %msg %n
-
-
-
-
-
-
-
+
+ target/sudoku.log
+
+ [%date{ISO8601}] [%level] [%logger] [%marker] [%thread] - %msg %n
+
+
-
-
+
+
+
-
diff --git a/exercises/exercise_021_multiversal_equality/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuProgressTracker.scala b/exercises/exercise_021_multiversal_equality/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuProgressTracker.scala
index 7968e5f84..6fe7711fc 100644
--- a/exercises/exercise_021_multiversal_equality/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuProgressTracker.scala
+++ b/exercises/exercise_021_multiversal_equality/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuProgressTracker.scala
@@ -32,10 +32,13 @@ class SudokuProgressTracker private (
def trackProgress(updatesInFlight: Int): Behavior[Command] =
Behaviors.receiveMessage {
case NewUpdatesInFlight(updateCount) if updatesInFlight - 1 == 0 =>
+ context.log.debug("NewUpdatesInFlight({}) - UpdatesInFlight={}", updateCount, updatesInFlight + updateCount)
rowDetailProcessors.foreach((_, processor) =>
processor ! SudokuDetailProcessor.GetSudokuDetailState(context.self))
+
collectEndState()
case NewUpdatesInFlight(updateCount) =>
+ context.log.debug("NewUpdatesInFlight({}) - UpdatesInFlight={}", updateCount, updatesInFlight + updateCount)
trackProgress(updatesInFlight + updateCount)
case msg: SudokuDetailState =>
context.log.error("Received unexpected message in state 'trackProgress': {}", msg)
diff --git a/exercises/exercise_021_multiversal_equality/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuSolver.scala b/exercises/exercise_021_multiversal_equality/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuSolver.scala
index f94f0e2c2..3082532b5 100644
--- a/exercises/exercise_021_multiversal_equality/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuSolver.scala
+++ b/exercises/exercise_021_multiversal_equality/src/main/scala/org/lunatechlabs/dotty/sudoku/SudokuSolver.scala
@@ -69,6 +69,7 @@ class SudokuSolver private (
rowUpdates.foreach { case SudokuDetailProcessor.RowUpdate(row, cellUpdates) =>
rowDetailProcessors(row) ! SudokuDetailProcessor.Update(cellUpdates, context.self)
}
+ context.log.debug("InitialRowUpdates: {}", rowUpdates)
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(rowUpdates.size)
processRequest(Some(sender), System.currentTimeMillis())
case unexpectedMsg =>
@@ -81,36 +82,75 @@ class SudokuSolver private (
Behaviors.receiveMessage {
case SudokuDetailProcessor.RowUpdate(rowNr, updates) =>
updates.foreach { (rowCellNr, newCellContent) =>
+ context.log.debug("Incoming update for Row({},{})={} ", rowNr, rowCellNr, newCellContent)
val (columnNr, columnCellNr) = rowToColumnCoordinates(rowNr, rowCellNr)
val columnUpdate = CellUpdates(columnCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from RowProcessor({}) for Column({}, {})={} ",
+ rowNr,
+ columnNr,
+ columnCellNr,
+ columnUpdate)
columnDetailProcessors(columnNr) ! SudokuDetailProcessor.Update(columnUpdate, context.self)
val (blockNr, blockCellNr) = rowToBlockCoordinates(rowNr, rowCellNr)
val blockUpdate = CellUpdates(blockCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from RowProcessor({}) for Block({}, {})={} ",
+ rowNr,
+ blockNr,
+ blockCellNr,
+ blockUpdate)
blockDetailProcessors(blockNr) ! SudokuDetailProcessor.Update(blockUpdate, context.self)
}
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(2 * updates.size - 1)
Behaviors.same
case SudokuDetailProcessor.ColumnUpdate(columnNr, updates) =>
updates.foreach { (colCellNr, newCellContent) =>
+ context.log.debug("Incoming update for Column({},{})={} ", columnNr, colCellNr, newCellContent)
val (rowNr, rowCellNr) = columnToRowCoordinates(columnNr, colCellNr)
val rowUpdate = CellUpdates(rowCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from ColumnProcessor({}) for Row({}, {})={} ",
+ columnNr,
+ rowNr,
+ rowCellNr,
+ rowUpdate)
rowDetailProcessors(rowNr) ! SudokuDetailProcessor.Update(rowUpdate, context.self)
val (blockNr, blockCellNr) = columnToBlockCoordinates(columnNr, colCellNr)
val blockUpdate = CellUpdates(blockCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from ColumnProcessor({}) for Block({}, {})={} ",
+ columnNr,
+ blockNr,
+ blockCellNr,
+ blockUpdate)
blockDetailProcessors(blockNr) ! SudokuDetailProcessor.Update(blockUpdate, context.self)
}
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(2 * updates.size - 1)
Behaviors.same
case SudokuDetailProcessor.BlockUpdate(blockNr, updates) =>
updates.foreach { (blockCellNr, newCellContent) =>
+ context.log.debug("Incoming update for Block({},{})={} ", blockNr, blockCellNr, newCellContent)
val (rowNr, rowCellNr) = blockToRowCoordinates(blockNr, blockCellNr)
val rowUpdate = CellUpdates(rowCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from BlockProcessor({}) for Row({}, {})={} ",
+ blockNr,
+ rowNr,
+ rowCellNr,
+ rowUpdate)
rowDetailProcessors(rowNr) ! SudokuDetailProcessor.Update(rowUpdate, context.self)
val (columnNr, columnCellNr) = blockToColumnCoordinates(blockNr, blockCellNr)
val columnUpdate = CellUpdates(columnCellNr -> newCellContent)
+ context.log.debug(
+ "Outgoing update from BlockProcessor({}) for Column({}, {})={} ",
+ blockNr,
+ columnNr,
+ columnCellNr,
+ columnUpdate)
columnDetailProcessors(columnNr) ! SudokuDetailProcessor.Update(columnUpdate, context.self)
}
progressTracker ! SudokuProgressTracker.NewUpdatesInFlight(2 * updates.size - 1)