diff --git a/README.md b/README.md index 52ce26e97..5464380e0 100644 --- a/README.md +++ b/README.md @@ -26,19 +26,19 @@ For people that want to skip the explanations and see it action, this is the pla ### Dependency Configuration ```scala -libraryDependencies += "com.outr" %% "scribe" % "3.12.1" +libraryDependencies += "com.outr" %% "scribe" % "3.12.2" ``` For Cross-Platform projects (JVM, JS, and/or Native): ```scala -libraryDependencies += "com.outr" %%% "scribe" % "3.12.1" +libraryDependencies += "com.outr" %%% "scribe" % "3.12.2" ``` Or, if you want interoperability with SLF4J (to allow better interoperability with existing libraries using other loggers): ```scala -libraryDependencies += "com.outr" %% "scribe-slf4j" % "3.12.1" +libraryDependencies += "com.outr" %% "scribe-slf4j" % "3.12.2" ``` ### Usage diff --git a/build.sbt b/build.sbt index 7aaccb449..9c45293eb 100644 --- a/build.sbt +++ b/build.sbt @@ -9,7 +9,7 @@ val allScalaVersions = List(scala213, scala212, scala3) name := "scribe" ThisBuild / organization := "com.outr" -ThisBuild / version := "3.12.1" +ThisBuild / version := "3.12.2" ThisBuild / scalaVersion := scala213 ThisBuild / scalacOptions ++= Seq("-unchecked", "-deprecation") ThisBuild / javacOptions ++= Seq("-source", "1.8", "-target", "1.8") diff --git a/core/shared/src/main/scala/scribe/mdc/MDCMap.scala b/core/shared/src/main/scala/scribe/mdc/MDCMap.scala index c9ec47abe..e00dcd291 100644 --- a/core/shared/src/main/scala/scribe/mdc/MDCMap.scala +++ b/core/shared/src/main/scala/scribe/mdc/MDCMap.scala @@ -3,14 +3,17 @@ package scribe.mdc import scribe.util.Time import perfolation._ +import java.util.concurrent.ConcurrentHashMap +import scala.jdk.CollectionConverters._ + class MDCMap(parent: Option[MDC]) extends MDC { - private var _map: Map[String, () => Any] = Map.empty + private val _map = new ConcurrentHashMap[String, () => Any] - override def map: Map[String, () => Any] = _map + override def map: Map[String, () => Any] = _map.asScala.toMap - override def get(key: String): Option[() => Any] = _map.get(key).orElse(parent.flatMap(_.get(key))) + override def get(key: String): Option[() => Any] = Option(_map.get(key)).orElse(parent.flatMap(_.get(key))) - override def update(key: String, value: => Any): Unit = _map = _map + (key -> (() => value)) + override def update(key: String, value: => Any): Unit = _map.put(key, () => value) override def contextualize[Return](key: String, value: => Any)(f: => Return): Return = { update(key, value) @@ -26,9 +29,9 @@ class MDCMap(parent: Option[MDC]) extends MDC { update(key, s"${((timeFunction() - start) / 1000.0).f()}s") } - override def remove(key: String): Unit = _map = _map - key + override def remove(key: String): Unit = _map.remove(key) override def contains(key: String): Boolean = map.contains(key) - override def clear(): Unit = _map = Map.empty + override def clear(): Unit = _map.clear() } \ No newline at end of file