I hereby claim:
- I am jschwietert on github.
- I am jschwietert (https://keybase.io/jschwietert) on keybase.
- I have a public key whose fingerprint is C672 94E9 5F0E 5605 FEF6 B432 9F5A D98B FF4A 4B14
To claim this, I am signing this object:
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)) | |
trait Logging { | |
def classLogVariables: LogVariables = Nil | |
implicit lazy protected[logging] val log = Logger.ClassLogger(this.getClass, classLogVariables) | |
} | |
trait ActorLogging extends Logging { | |
this: akka.actor.Actor => | |
implicit override lazy protected[logging] val log = Logger.ActorLogger(this, classLogVariables) | |
} |
def format(phoneNumber: String)(implicit log: Logger) |
type LogVariable = (String, Any) | |
def info(msg: => String, variables: LogVariable*): Unit |
+ override def classLogVariables: LogVariables = Seq(“org” -> orgSlug, “incidentId” -> incidentId, “policy” -> policySlug) | |
+ | |
override def preStart(): Unit = { | |
- log.info(s”Starting EscalationPolicyActor [org=$orgSlug] [incidentId=$incidentId] [policy=$policySlug]”) | |
+ log.info(“Starting EscalationPolicyActor”) | |
super.preStart() | |
} | |
override def postStop(): Unit = { | |
- log.info(s”Stopping EscalationPolicyActor [org=$orgSlug] [incidentId=$incidentId] [policy=$policySlug]”) |
Jun 21 17:43:49 server1.pr.victorops.com WARN victorops.controllers.api.UserController$ – Invalid phone number: ‘555-55-555’ :: [org=victorops] [user=jonathan] |
Jun 21 17:43:49 server1.pr.victorops.com WARN victorops.common.util.PhoneFormat$ - Invalid phone number: ‘555-55-555’ |
- .getOrElse(Future.failed(s”Unable to locate webhook [org=$orgSlug] [incidentId=$incidentId] [policy=$policySlug]”)) | |
// prints: Unable to locate webhook [org=victorops] [incidentId=1234] [policy=yolo] | |
+ .getOrElse(Future.failed(log.format(“Unable to locate webhook”))) | |
// prints: Unable to locate webhook :: [org=victorops] [incidentId=1234] [policy=yolo] |
- log.info(s”escalation [resultSummary: $resultSummary” ) | |
// prints: escalation [resultSummary: ResultSummary(…) | |
+ log.info(“escalation”, “resultSummary” -> resultSummary) | |
// prints: escalation :: [resultSummary=ResultSummary(…)] |
I hereby claim:
To claim this, I am signing this object: