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
modules/logging/scribe/src/main/scala/docspell/logging/impl
project

@ -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 = {

@ -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 = {

@ -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,

@ -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)
}
}

@ -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"