Skip to content

Commit

Permalink
Release 3.12.2
Browse files Browse the repository at this point in the history
  • Loading branch information
darkfrog26 committed Sep 1, 2023
1 parent b7cb614 commit 685f1af
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
15 changes: 9 additions & 6 deletions core/shared/src/main/scala/scribe/mdc/MDCMap.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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()
}

0 comments on commit 685f1af

Please sign in to comment.