diff options
Diffstat (limited to 'core-reporting/src/main/scala/xyz/driver/core/reporting/GoogleMdcLogger.scala')
-rw-r--r-- | core-reporting/src/main/scala/xyz/driver/core/reporting/GoogleMdcLogger.scala | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/core-reporting/src/main/scala/xyz/driver/core/reporting/GoogleMdcLogger.scala b/core-reporting/src/main/scala/xyz/driver/core/reporting/GoogleMdcLogger.scala new file mode 100644 index 0000000..f5c41cf --- /dev/null +++ b/core-reporting/src/main/scala/xyz/driver/core/reporting/GoogleMdcLogger.scala @@ -0,0 +1,14 @@ +package xyz.driver.core +package reporting + +import org.slf4j.MDC + +trait GoogleMdcLogger extends Reporter { self: GoogleReporter => + + abstract override def log(severity: Reporter.Severity, message: String, reason: Option[Throwable])( + implicit ctx: SpanContext): Unit = { + MDC.put("trace", s"projects/${credentials.getProjectId}/traces/${ctx.traceId}") + super.log(severity, message, reason) + } + +} |