From f6fd155150d204ae51f68e379703ce6325ec78e2 Mon Sep 17 00:00:00 2001 From: eikek Date: Mon, 27 Jun 2022 13:27:01 +0200 Subject: [PATCH] Update scribe to 3.9.0 --- .../scala/docspell/logging/impl/JsonWriter.scala | 4 ++-- .../scala/docspell/logging/impl/LogfmtWriter.scala | 4 ++-- .../main/scala/docspell/logging/impl/Record.scala | 13 +++++++++---- .../scala/docspell/logging/impl/ScribeWrapper.scala | 8 ++++---- project/Dependencies.scala | 2 +- 5 files changed, 18 insertions(+), 13 deletions(-) diff --git a/modules/logging/scribe/src/main/scala/docspell/logging/impl/JsonWriter.scala b/modules/logging/scribe/src/main/scala/docspell/logging/impl/JsonWriter.scala index 020fc9f9..653dab0f 100644 --- a/modules/logging/scribe/src/main/scala/docspell/logging/impl/JsonWriter.scala +++ b/modules/logging/scribe/src/main/scala/docspell/logging/impl/JsonWriter.scala @@ -13,8 +13,8 @@ import scribe.output.format.OutputFormat import scribe.writer._ final case class JsonWriter(writer: Writer, compact: Boolean = true) extends Writer { - override def write[M]( - record: LogRecord[M], + override def write( + record: LogRecord, output: LogOutput, outputFormat: OutputFormat ): Unit = { diff --git a/modules/logging/scribe/src/main/scala/docspell/logging/impl/LogfmtWriter.scala b/modules/logging/scribe/src/main/scala/docspell/logging/impl/LogfmtWriter.scala index f9f4db12..01ef9adb 100644 --- a/modules/logging/scribe/src/main/scala/docspell/logging/impl/LogfmtWriter.scala +++ b/modules/logging/scribe/src/main/scala/docspell/logging/impl/LogfmtWriter.scala @@ -14,8 +14,8 @@ import scribe.writer._ // https://brandur.org/logfmt final case class LogfmtWriter(writer: Writer) extends Writer { - override def write[M]( - record: LogRecord[M], + override def write( + record: LogRecord, output: LogOutput, outputFormat: OutputFormat ): Unit = { diff --git a/modules/logging/scribe/src/main/scala/docspell/logging/impl/Record.scala b/modules/logging/scribe/src/main/scala/docspell/logging/impl/Record.scala index 68123a5f..165b2333 100644 --- a/modules/logging/scribe/src/main/scala/docspell/logging/impl/Record.scala +++ b/modules/logging/scribe/src/main/scala/docspell/logging/impl/Record.scala @@ -38,18 +38,23 @@ private[impl] case class Record( private[impl] object Record { - def fromLogRecord[M](record: LogRecord[M]): Record = { + def fromLogRecord(record: LogRecord): Record = { val l = record.timeStamp - val traces = record.additionalMessages.collect { + val traces = record.messages.collect { case message: Message[_] if message.value.isInstanceOf[Throwable] => throwable2Trace(message.value.asInstanceOf[Throwable]) } - val additionalMessages = record.additionalMessages.map(_.logOutput.plainText) + val (firstMessage, additionalMessages) = record.messages match { + case h :: rest => + (h.logOutput.plainText, rest.map(_.logOutput.plainText)) + case Nil => + ("", Nil) + } Record( level = record.level.name, levelValue = record.levelValue, - message = record.logOutput.plainText, + message = firstMessage, additionalMessages = additionalMessages, fileName = record.fileName, className = record.className, diff --git a/modules/logging/scribe/src/main/scala/docspell/logging/impl/ScribeWrapper.scala b/modules/logging/scribe/src/main/scala/docspell/logging/impl/ScribeWrapper.scala index d547225c..143fe7fc 100644 --- a/modules/logging/scribe/src/main/scala/docspell/logging/impl/ScribeWrapper.scala +++ b/modules/logging/scribe/src/main/scala/docspell/logging/impl/ScribeWrapper.scala @@ -12,7 +12,7 @@ import cats.effect.Sync import docspell.logging.{Level, LogEvent, Logger} import scribe.LoggerSupport -import scribe.message.{LoggableMessage, Message} +import scribe.message.LoggableMessage private[logging] object ScribeWrapper { final class ImplUnsafe(log: scribe.Logger) extends Logger[Id] { @@ -41,10 +41,10 @@ private[logging] object ScribeWrapper { private[this] def convert(ev: LogEvent) = { val level = convertLevel(ev.level) val additional: List[LoggableMessage] = ev.additional.map { - case Right(ex) => Message.static(ex) - case Left(msg) => Message.static(msg) + case Right(ex) => LoggableMessage.throwable2Message(ex) + case Left(msg) => LoggableMessage.string2Message(msg) }.toList - LoggerSupport(level, ev.msg(), additional, ev.pkg, ev.fileName, ev.name, ev.line) + LoggerSupport(level, ev.msg() :: additional, ev.pkg, ev.fileName, ev.name, ev.line) .copy(data = ev.data.toDeferred) } } diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 5a03984b..25b405e3 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -43,7 +43,7 @@ object Dependencies { val PureConfigVersion = "0.17.1" val ScalaJavaTimeVersion = "2.4.0" val ScodecBitsVersion = "1.1.31" - val ScribeVersion = "3.8.3" + val ScribeVersion = "3.9.0" val Slf4jVersion = "1.7.36" val SourcecodeVersion = "0.2.8" val StanfordNlpVersion = "4.4.0"