Skip to content

Commit

Permalink
Add ce3 module and iolocal instances
Browse files Browse the repository at this point in the history
  • Loading branch information
wunderk1nd-e committed Aug 17, 2022
1 parent 3aa06d9 commit 8e15187
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
10 changes: 10 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,16 @@ lazy val noop = crossProject(JSPlatform, JVMPlatform)
name := "log4cats-noop"
)

lazy val ce3 = crossProject(JSPlatform, JVMPlatform)
.settings(commonSettings)
.dependsOn(core)
.settings(
name := "log4cats-ce3",
libraryDependencies ++= Seq(
"org.typelevel" %%% "cats-effect" % catsEffectV
)
)

lazy val slf4j = project
.settings(commonSettings)
.dependsOn(core.jvm)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package org.typelevel.log4cats.ce3

import cats.effect.{IO, IOLocal}
import org.typelevel.log4cats.{LoggerFactory, SelfAwareStructuredLogger}

object IOLocalHelpers {
def loggerWithContextFromIOLocal(
sl: SelfAwareStructuredLogger[IO],
local: IOLocal[Map[String, String]]
): SelfAwareStructuredLogger[IO] = SelfAwareStructuredLogger.withContextF(sl)(local.get)

def factoryWithContextFromKleisli(
lf: LoggerFactory[IO],
local: IOLocal[Map[String, String]]
): LoggerFactory[IO] = LoggerFactory.withContextF(lf)(local.get)
}

0 comments on commit 8e15187

Please sign in to comment.