Skip to content

Commit 685f1af

Browse files
committed
Release 3.12.2
1 parent b7cb614 commit 685f1af

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,19 @@ For people that want to skip the explanations and see it action, this is the pla
2626
### Dependency Configuration
2727

2828
```scala
29-
libraryDependencies += "com.outr" %% "scribe" % "3.12.1"
29+
libraryDependencies += "com.outr" %% "scribe" % "3.12.2"
3030
```
3131

3232
For Cross-Platform projects (JVM, JS, and/or Native):
3333

3434
```scala
35-
libraryDependencies += "com.outr" %%% "scribe" % "3.12.1"
35+
libraryDependencies += "com.outr" %%% "scribe" % "3.12.2"
3636
```
3737

3838
Or, if you want interoperability with SLF4J (to allow better interoperability with existing libraries using other loggers):
3939

4040
```scala
41-
libraryDependencies += "com.outr" %% "scribe-slf4j" % "3.12.1"
41+
libraryDependencies += "com.outr" %% "scribe-slf4j" % "3.12.2"
4242
```
4343

4444
### Usage

build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ val allScalaVersions = List(scala213, scala212, scala3)
99

1010
name := "scribe"
1111
ThisBuild / organization := "com.outr"
12-
ThisBuild / version := "3.12.1"
12+
ThisBuild / version := "3.12.2"
1313
ThisBuild / scalaVersion := scala213
1414
ThisBuild / scalacOptions ++= Seq("-unchecked", "-deprecation")
1515
ThisBuild / javacOptions ++= Seq("-source", "1.8", "-target", "1.8")

core/shared/src/main/scala/scribe/mdc/MDCMap.scala

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,17 @@ package scribe.mdc
33
import scribe.util.Time
44
import perfolation._
55

6+
import java.util.concurrent.ConcurrentHashMap
7+
import scala.jdk.CollectionConverters._
8+
69
class MDCMap(parent: Option[MDC]) extends MDC {
7-
private var _map: Map[String, () => Any] = Map.empty
10+
private val _map = new ConcurrentHashMap[String, () => Any]
811

9-
override def map: Map[String, () => Any] = _map
12+
override def map: Map[String, () => Any] = _map.asScala.toMap
1013

11-
override def get(key: String): Option[() => Any] = _map.get(key).orElse(parent.flatMap(_.get(key)))
14+
override def get(key: String): Option[() => Any] = Option(_map.get(key)).orElse(parent.flatMap(_.get(key)))
1215

13-
override def update(key: String, value: => Any): Unit = _map = _map + (key -> (() => value))
16+
override def update(key: String, value: => Any): Unit = _map.put(key, () => value)
1417

1518
override def contextualize[Return](key: String, value: => Any)(f: => Return): Return = {
1619
update(key, value)
@@ -26,9 +29,9 @@ class MDCMap(parent: Option[MDC]) extends MDC {
2629
update(key, s"${((timeFunction() - start) / 1000.0).f()}s")
2730
}
2831

29-
override def remove(key: String): Unit = _map = _map - key
32+
override def remove(key: String): Unit = _map.remove(key)
3033

3134
override def contains(key: String): Boolean = map.contains(key)
3235

33-
override def clear(): Unit = _map = Map.empty
36+
override def clear(): Unit = _map.clear()
3437
}

0 commit comments

Comments
 (0)