-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ce3 module and iolocal instances
- Loading branch information
1 parent
8709392
commit d8f1164
Showing
2 changed files
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
ce3/shared/src/main/scala/org/typelevel/log4cats/ce3/IOLocalHelpers.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 factoryWithContextFromIOLocal( | ||
lf: LoggerFactory[IO], | ||
local: IOLocal[Map[String, String]] | ||
): LoggerFactory[IO] = LoggerFactory.withContextF(lf)(local.get) | ||
} |