Skip to content

Instantly share code, notes, and snippets.

@ml10
Last active March 2, 2018 20:24
Show Gist options
  • Save ml10/b5f56d5bf2279cd0b9e5ba7e5b33f5b0 to your computer and use it in GitHub Desktop.
Save ml10/b5f56d5bf2279cd0b9e5ba7e5b33f5b0 to your computer and use it in GitHub Desktop.
Double Info Logging with Scribe
2018.03.03 14:23:08 [run-main-2] INFO org.ml10.ScribeDoubleInfo:7 - info
2018.03.03 14:23:08 [run-main-2] INFO org.ml10.ScribeDoubleInfo:9 - info
2018.03.03 14:23:08 [run-main-2] INFO org.ml10.ScribeDoubleInfo:12 - info
2018.03.03 14:23:08 [run-main-2] INFO org.ml10.ScribeDoubleInfo:12 - info
2018.03.03 14:23:08 [run-main-2] DEBUG org.ml10.ScribeDoubleInfo:13 - debug
package org.ml10
import scribe._
object ScribeDoubleInfo extends App {
debug("debug")
info("info")
configureLogging("org.ml10.ScribeDoubleInfo", false)
info("info")
debug("debug")
configureLogging("org.ml10.ScribeDoubleInfo", true)
info("info")
debug("debug")
def configureLogging(debugPath: String, combined: Boolean): Unit = {
if (combined) {
Logger.update(debugPath)(_.clearHandlers().withHandler(minimumLevel = Level.Debug))
} else {
val logger = Logger.byName(debugPath)
logger.clearHandlers()
logger.withHandler(minimumLevel = Level.Debug)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment