LogZIO
Attributes
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
LogZIO.type
Members list
Type members
Classlikes
Lets you carry LogZIO capability in environment
Lets you carry LogZIO capability in environment
import logstage.LogZIO
import logstage.LogZIO.log
import zio.URIO
def fn: URIO[LogZIO, Unit] = {
log.info(s"I'm logging with ${log}stage!")
}
Attributes
- Supertypes
-
class Objecttrait Matchableclass AnyShow all
- Self type
-
log.type
Value members
Concrete methods
Allows to provide logging context which will be passed through the given effect via ZIO environment.
Allows to provide logging context which will be passed through the given effect via ZIO environment.
import logstage.LogZIO
import logstage.LogZIO.log
import zio.ZIO
def databaseCall(): ZIO[LogZIO, Throwable, String] = ZIO.succeed("stubbed")
def dbLayerFunction(arg: Int): ZIO[LogZIO, Throwable, String] = {
LogZIO.withCustomContext("arg" -> arg) {
for {
result <- databaseCall
_ <- log.info(s"Database call $result") // … arg=1 Database call result=stubbed
} yield result
}
}
Type parameters
- A
-
effect return type
- E
-
effect error type
- R
-
environment of the provided effect
Value parameters
- context
-
context to be provided
- thunk
-
the effect for which context will be passed
Attributes
- Returns
-
effect with the passed context
Allows to provide logging context which will be passed through the given effect via ZIO environment.
Allows to provide logging context which will be passed through the given effect via ZIO environment.
import izumi.logstage.api.Log.CustomContext
import logstage.LogZIO
import logstage.LogZIO.log
import zio.ZIO
def databaseCall(): ZIO[LogZIO, Throwable, String] = ZIO.succeed("stubbed")
def dbLayerFunction(arg: Int): ZIO[LogZIO, Throwable, String] = {
LogZIO.withCustomContext(CustomContext("arg" -> arg)) {
for {
result <- databaseCall
_ <- log.info(s"Database call $result") // … arg=1 Database call result=stubbed
} yield result
}
}
Type parameters
- A
-
effect return type
- E
-
effect error type
- R
-
environment of the provided effect
Value parameters
- context
-
context to be provided
- thunk
-
the effect for which context will be passed
Attributes
- Returns
-
effect with the passed context