Created
September 22, 2017 17:20
-
-
Save scuddalo/180bc937f8b4f71e598d1e623e236502 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
implicit val handler: LogHandler = { | |
val sqlLogger = LoggerFactory.getLogger(getClass.getName) | |
LogHandler { | |
case Success(s, a, e1, e2) => | |
sqlLogger.info(s"""Successful Statement Execution: | |
| ${s.lines.dropWhile(_.trim.isEmpty).mkString("\n ")} | |
| | |
| arguments = [${a.mkString(", ")}] | |
| elapsed = ${e1.toMillis} ms exec + ${e2.toMillis} ms processing (${(e1 + e2).toMillis} ms total) | |
""".stripMargin) | |
case ProcessingFailure(s, a, e1, e2, t) => | |
sqlLogger.warn(s"""Failed Resultset Processing: | |
| ${s.lines.dropWhile(_.trim.isEmpty).mkString("\n ")} | |
| | |
| arguments = [${a.mkString(", ")}] | |
| elapsed = ${e1.toMillis} ms exec + ${e2.toMillis} ms processing (failed) (${(e1 + e2).toMillis} ms total) | |
| | |
""".stripMargin) | |
case ExecFailure(s, a, e1, t) => | |
sqlLogger.warn(s"""Failed Statement Execution: | |
| ${s.lines.dropWhile(_.trim.isEmpty).mkString("\n ")} | |
| | |
| arguments = [${a.mkString(", ")}] | |
| elapsed = ${e1.toMillis} ms exec (failed) | |
| failure = ${t.getMessage} | |
""".stripMargin) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment