Created
July 20, 2017 19:07
-
-
Save jschwietert/91537e603377e84e459c928b625b4b79 to your computer and use it in GitHub Desktop.
Scaled down Logger implementation of VictorOps unified logging.
This file contains hidden or 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
| 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)) | |
| // Here down requires implementation per Logger type: ClassLogger & ActorLogger | |
| def getName: String | |
| def classLogVariables: LogVariables | |
| def isInfoEnabled: Boolean | |
| // ... | |
| def isErrorEnabled: Boolean | |
| protected def logInfo(msg: String): Unit | |
| // ... | |
| protected def logError(msg: String): Unit | |
| protected def logError(t: Throwable, msg: String): Unit | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment