~wegtam/smederee

Showing details for patch 740bc9467564821254d528f6857ae63b62bb45eb.
2024-09-19 (Thu), 7:19 AM - Jens Grassel - 740bc9467564821254d528f6857ae63b62bb45eb

Update doobie to 1.0.0-RC6

Summary of changes
2 files modified with 35 lines added and 35 lines removed
  • build.sbt with 1 added and 1 removed lines
  • modules/hub/src/main/scala/de/smederee/tickets/Slf4jLogHandler.scala with 34 added and 34 removed lines
diff -rN -u old-smederee/build.sbt new-smederee/build.sbt
--- old-smederee/build.sbt	2024-11-22 21:39:30.377668952 +0000
+++ new-smederee/build.sbt	2024-11-22 21:39:30.377668952 +0000
@@ -279,7 +279,7 @@
             val cats             = "2.12.0"
             val catsEffect       = "3.5.4"
             val circe            = "0.14.10"
-            val doobie           = "1.0.0-RC5"
+            val doobie           = "1.0.0-RC6"
             val flyway           = "10.18.0"
             val fs2              = "3.5.0"
             val http4s           = "1.0.0-M41"
diff -rN -u old-smederee/modules/hub/src/main/scala/de/smederee/tickets/Slf4jLogHandler.scala new-smederee/modules/hub/src/main/scala/de/smederee/tickets/Slf4jLogHandler.scala
--- old-smederee/modules/hub/src/main/scala/de/smederee/tickets/Slf4jLogHandler.scala	2024-11-22 21:39:30.377668952 +0000
+++ new-smederee/modules/hub/src/main/scala/de/smederee/tickets/Slf4jLogHandler.scala	2024-11-22 21:39:30.377668952 +0000
@@ -13,11 +13,11 @@
 object Slf4jLogHandler {
     private val RedactArguments: Boolean = true // This SHALL only be set to `false` when debugging issues!
 
-    private val sqlArgumentsToLogString: List[Any] => String = arguments =>
+    private val sqlArgumentsToLogString: List[List[Any]] => String = arguments =>
         if (RedactArguments)
-            arguments.map(_ => "redacted").mkString(", ")
+            arguments.map(_.map(_ => "redacted").mkString("(", ", ", ")")).mkString("[", ", ", "]")
         else
-            arguments.mkString(", ")
+            arguments.map(_.mkString("(", ", ", ")")).mkString("[", ", ", "]")
 
     private val sqlQueryToLogString: String => String = _.linesIterator.dropWhile(_.trim.isEmpty).mkString("\n  ")
 
@@ -34,44 +34,44 @@
             def run(logEvent: LogEvent): F[Unit] =
                 Sync[F].delay {
                     logEvent match {
-                        case Success(sqlQuery, arguments, label, executionTime, processingTime) =>
+                        case Success(sqlQuery, parameters, label, executionTime, processingTime) =>
                             log.debug(s"""SQL command successful:
-                           |
-                           | ${sqlQueryToLogString(sqlQuery)}
-                           |
-                           | arguments: [${sqlArgumentsToLogString(arguments)}]
-                           | label: $label
-                           |
-                           | execution time : ${executionTime.toMillis} ms
-                           | processing time: ${processingTime.toMillis} ms
-                           | total time     : ${(executionTime + processingTime).toMillis} ms
-                           |""".stripMargin)
-                        case ProcessingFailure(sqlQuery, arguments, label, executionTime, processingTime, failure) =>
+                                       |
+                                       | ${sqlQueryToLogString(sqlQuery)}
+                                       |
+                                       | arguments: [${sqlArgumentsToLogString(parameters.allParams)}]
+                                       | label: $label
+                                       |
+                                       | execution time : ${executionTime.toMillis} ms
+                                       | processing time: ${processingTime.toMillis} ms
+                                       | total time     : ${(executionTime + processingTime).toMillis} ms
+                                       |""".stripMargin)
+                        case ProcessingFailure(sqlQuery, parameters, label, executionTime, processingTime, failure) =>
                             log.error(
                                 s"""SQL PROCESSING FAILURE:
-                   |
-                   | ${sqlQueryToLogString(sqlQuery)}
-                   |
-                   | arguments: [${sqlArgumentsToLogString(arguments)}]
-                   | label: $label
-                   |
-                   | execution time : ${executionTime.toMillis} ms
-                   | processing time: ${processingTime.toMillis} ms
-                   | total time     : ${(executionTime + processingTime).toMillis} ms
-                   |""".stripMargin,
+                                   |
+                                   | ${sqlQueryToLogString(sqlQuery)}
+                                   |
+                                   | arguments: [${sqlArgumentsToLogString(parameters.allParams)}]
+                                   | label: $label
+                                   |
+                                   | execution time : ${executionTime.toMillis} ms
+                                   | processing time: ${processingTime.toMillis} ms
+                                   | total time     : ${(executionTime + processingTime).toMillis} ms
+                                   |""".stripMargin,
                                 failure
                             )
-                        case ExecFailure(sqlQuery, arguments, label, executionTime, failure) =>
+                        case ExecFailure(sqlQuery, parameters, label, executionTime, failure) =>
                             log.error(
                                 s"""SQL EXECUTION FAILURE:
-                   |
-                   | ${sqlQueryToLogString(sqlQuery)}
-                   |
-                   | arguments: [${sqlArgumentsToLogString(arguments)}]
-                   | label: $label
-                   |
-                   | execution time : ${executionTime.toMillis} ms
-                   |""".stripMargin,
+                                   |
+                                   | ${sqlQueryToLogString(sqlQuery)}
+                                   |
+                                   | arguments: [${sqlArgumentsToLogString(parameters.allParams)}]
+                                   | label: $label
+                                   |
+                                   | execution time : ${executionTime.toMillis} ms
+                                   |""".stripMargin,
                                 failure
                             )
                     }