Skip to content

Instantly share code, notes, and snippets.

View jschwietert's full-sized avatar

Jonathan Schwietert jschwietert

View GitHub Profile
@jschwietert
jschwietert / scala_unified_logging-logger.scala
Created July 20, 2017 19:07
Scaled down Logger implementation of VictorOps unified logging.
trait Logger {
final protected def format(t: Throwable, msg: => String, variables: LogVariables): String
final def format(msg: => String, variables: LogVariable*): String
final def info(msg: => String, variables: LogVariable*): Unit = if (isInfoEnabled) logInfo(format(msg, variables))
// ...
final def error(msg: => String, variables: LogVariable*): Unit = if (isErrorEnabled) logError(format(msg, variables))
final def error(t: Throwable, msg: => String, variables: LogVariable*) = if (isErrorEnabled) logError(t, format(t, msg, variables))