mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-22 10:28:27 +00:00
Merge pull request #1411 from scala-steward/update/scribe-3.8.0
Update scribe, scribe-slf4j to 3.8.0
This commit is contained in:
@ -13,6 +13,7 @@ import docspell.logging.{Level, LogConfig}
|
|||||||
|
|
||||||
import scribe.format.Formatter
|
import scribe.format.Formatter
|
||||||
import scribe.jul.JULHandler
|
import scribe.jul.JULHandler
|
||||||
|
import scribe.writer.SystemOutWriter
|
||||||
|
|
||||||
object ScribeConfigure {
|
object ScribeConfigure {
|
||||||
private[this] val docspellRootVerbose = "DOCSPELL_ROOT_LOGGER_LEVEL"
|
private[this] val docspellRootVerbose = "DOCSPELL_ROOT_LOGGER_LEVEL"
|
||||||
@ -45,13 +46,13 @@ object ScribeConfigure {
|
|||||||
l =>
|
l =>
|
||||||
cfg.format match {
|
cfg.format match {
|
||||||
case Format.Fancy =>
|
case Format.Fancy =>
|
||||||
l.withHandler(formatter = Formatter.enhanced, writer = StdoutWriter)
|
l.withHandler(formatter = Formatter.enhanced, writer = SystemOutWriter)
|
||||||
case Format.Plain =>
|
case Format.Plain =>
|
||||||
l.withHandler(formatter = Formatter.classic, writer = StdoutWriter)
|
l.withHandler(formatter = Formatter.classic, writer = SystemOutWriter)
|
||||||
case Format.Json =>
|
case Format.Json =>
|
||||||
l.withHandler(writer = JsonWriter(StdoutWriter))
|
l.withHandler(writer = JsonWriter(SystemOutWriter))
|
||||||
case Format.Logfmt =>
|
case Format.Logfmt =>
|
||||||
l.withHandler(writer = LogfmtWriter(StdoutWriter))
|
l.withHandler(writer = LogfmtWriter(SystemOutWriter))
|
||||||
},
|
},
|
||||||
_.replace()
|
_.replace()
|
||||||
)
|
)
|
||||||
|
@ -1,56 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2020 Eike K. & Contributors
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
||||||
*/
|
|
||||||
|
|
||||||
package docspell.logging.impl
|
|
||||||
|
|
||||||
import scribe._
|
|
||||||
import scribe.output.LogOutput
|
|
||||||
import scribe.output.format.OutputFormat
|
|
||||||
import scribe.writer.Writer
|
|
||||||
|
|
||||||
// From: https://github.com/outr/scribe/blob/8e99521e1ee1f0c421629764dd96e4eb193d84bd/core/shared/src/main/scala/scribe/writer/SystemOutputWriter.scala
|
|
||||||
// Modified to always log to stdout. The original code was logging to stdout and stderr
|
|
||||||
// depending on the log level.
|
|
||||||
// Original code licensed under MIT
|
|
||||||
|
|
||||||
private[impl] object StdoutWriter extends Writer {
|
|
||||||
|
|
||||||
/** If true, will always synchronize writing to the console to avoid interleaved text.
|
|
||||||
* Most native consoles will handle this automatically, but IntelliJ and Eclipse are
|
|
||||||
* notorious about not properly handling this. Defaults to true.
|
|
||||||
*/
|
|
||||||
val synchronizeWriting: Boolean = true
|
|
||||||
|
|
||||||
/** Workaround for some consoles that don't play nicely with asynchronous calls */
|
|
||||||
val alwaysFlush: Boolean = false
|
|
||||||
|
|
||||||
private val stringBuilders = new ThreadLocal[StringBuilder] {
|
|
||||||
override def initialValue(): StringBuilder = new StringBuilder(512)
|
|
||||||
}
|
|
||||||
|
|
||||||
@annotation.nowarn
|
|
||||||
override def write[M](
|
|
||||||
record: LogRecord[M],
|
|
||||||
output: LogOutput,
|
|
||||||
outputFormat: OutputFormat
|
|
||||||
): Unit = {
|
|
||||||
val stream = Logger.system.out
|
|
||||||
val sb = stringBuilders.get()
|
|
||||||
outputFormat.begin(sb.append(_))
|
|
||||||
outputFormat(output, s => sb.append(s))
|
|
||||||
outputFormat.end(sb.append(_))
|
|
||||||
if (synchronizeWriting) {
|
|
||||||
synchronized {
|
|
||||||
stream.println(sb.toString())
|
|
||||||
if (alwaysFlush) stream.flush()
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
stream.println(sb.toString())
|
|
||||||
if (alwaysFlush) stream.flush()
|
|
||||||
}
|
|
||||||
sb.clear()
|
|
||||||
}
|
|
||||||
}
|
|
@ -42,7 +42,7 @@ object Dependencies {
|
|||||||
val PureConfigVersion = "0.17.1"
|
val PureConfigVersion = "0.17.1"
|
||||||
val ScalaJavaTimeVersion = "2.3.0"
|
val ScalaJavaTimeVersion = "2.3.0"
|
||||||
val ScodecBitsVersion = "1.1.30"
|
val ScodecBitsVersion = "1.1.30"
|
||||||
val ScribeVersion = "3.7.1"
|
val ScribeVersion = "3.8.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"
|
||||||
|
Reference in New Issue
Block a user