Update scribe to 3.9.0

This commit is contained in:
eikek 2022-06-27 13:27:01 +02:00
parent bca2ea28e3
commit f6fd155150
5 changed files with 18 additions and 13 deletions

View File

@ -13,8 +13,8 @@ import scribe.output.format.OutputFormat
import scribe.writer._ import scribe.writer._
final case class JsonWriter(writer: Writer, compact: Boolean = true) extends Writer { final case class JsonWriter(writer: Writer, compact: Boolean = true) extends Writer {
override def write[M]( override def write(
record: LogRecord[M], record: LogRecord,
output: LogOutput, output: LogOutput,
outputFormat: OutputFormat outputFormat: OutputFormat
): Unit = { ): Unit = {

View File

@ -14,8 +14,8 @@ import scribe.writer._
// https://brandur.org/logfmt // https://brandur.org/logfmt
final case class LogfmtWriter(writer: Writer) extends Writer { final case class LogfmtWriter(writer: Writer) extends Writer {
override def write[M]( override def write(
record: LogRecord[M], record: LogRecord,
output: LogOutput, output: LogOutput,
outputFormat: OutputFormat outputFormat: OutputFormat
): Unit = { ): Unit = {

View File

@ -38,18 +38,23 @@ private[impl] case class Record(
private[impl] object Record { private[impl] object Record {
def fromLogRecord[M](record: LogRecord[M]): Record = { def fromLogRecord(record: LogRecord): Record = {
val l = record.timeStamp val l = record.timeStamp
val traces = record.additionalMessages.collect { val traces = record.messages.collect {
case message: Message[_] if message.value.isInstanceOf[Throwable] => case message: Message[_] if message.value.isInstanceOf[Throwable] =>
throwable2Trace(message.value.asInstanceOf[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( Record(
level = record.level.name, level = record.level.name,
levelValue = record.levelValue, levelValue = record.levelValue,
message = record.logOutput.plainText, message = firstMessage,
additionalMessages = additionalMessages, additionalMessages = additionalMessages,
fileName = record.fileName, fileName = record.fileName,
className = record.className, className = record.className,

View File

@ -12,7 +12,7 @@ import cats.effect.Sync
import docspell.logging.{Level, LogEvent, Logger} import docspell.logging.{Level, LogEvent, Logger}
import scribe.LoggerSupport import scribe.LoggerSupport
import scribe.message.{LoggableMessage, Message} import scribe.message.LoggableMessage
private[logging] object ScribeWrapper { private[logging] object ScribeWrapper {
final class ImplUnsafe(log: scribe.Logger) extends Logger[Id] { final class ImplUnsafe(log: scribe.Logger) extends Logger[Id] {
@ -41,10 +41,10 @@ private[logging] object ScribeWrapper {
private[this] def convert(ev: LogEvent) = { private[this] def convert(ev: LogEvent) = {
val level = convertLevel(ev.level) val level = convertLevel(ev.level)
val additional: List[LoggableMessage] = ev.additional.map { val additional: List[LoggableMessage] = ev.additional.map {
case Right(ex) => Message.static(ex) case Right(ex) => LoggableMessage.throwable2Message(ex)
case Left(msg) => Message.static(msg) case Left(msg) => LoggableMessage.string2Message(msg)
}.toList }.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) .copy(data = ev.data.toDeferred)
} }
} }

View File

@ -43,7 +43,7 @@ object Dependencies {
val PureConfigVersion = "0.17.1" val PureConfigVersion = "0.17.1"
val ScalaJavaTimeVersion = "2.4.0" val ScalaJavaTimeVersion = "2.4.0"
val ScodecBitsVersion = "1.1.31" val ScodecBitsVersion = "1.1.31"
val ScribeVersion = "3.8.3" val ScribeVersion = "3.9.0"
val Slf4jVersion = "1.7.36" val Slf4jVersion = "1.7.36"
val SourcecodeVersion = "0.2.8" val SourcecodeVersion = "0.2.8"
val StanfordNlpVersion = "4.4.0" val StanfordNlpVersion = "4.4.0"