LogZIO

logstage.LogZIO
object LogZIO

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
LogZIO.type

Members list

Type members

Classlikes

object log

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
trait LogIO[[_] =>> ZIO[LogIO3[ZIO], Nothing, _$3]]
trait AbstractMacroLogIO[[_] =>> ZIO[LogIO3[ZIO], Nothing, _$3]]
trait EncodingAwareAbstractLogIO[[_] =>> ZIO[LogIO3[ZIO], Nothing, _$3], AnyEncoded]
trait AbstractLogIO[[_] =>> ZIO[LogIO3[ZIO], Nothing, _$3]]
trait UnsafeLogIO[[_] =>> ZIO[LogIO3[ZIO], Nothing, _$3]]
trait LogCreateIO[[_] =>> ZIO[LogIO3[ZIO], Nothing, _$3]]
class Object
trait Matchable
class Any
Show all
Self type
log.type

Types

type Service = LogIO3[ZIO]

Value members

Concrete methods

def addFiberIdToLogger[G[_], R, E, A](logger: AbstractLoggerF[G])(f: logger.Self => ZIO[R, E, A]): ZIO[R, E, A]
def withCustomContext[R : Tag, E, A](context: (String, AnyEncoded)*)(thunk: ZIO[R, E, A]): ZIO[R & LogZIO, E, A]

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

def withCustomContext[R : Tag, E, A](context: CustomContext)(thunk: ZIO[R, E, A]): ZIO[R & LogZIO, E, A]

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

def withDynamicContext[R](logger: AbstractLogger)(dynamic: ZIO[R, Nothing, CustomContext]): LogIO2[[_, _] =>> ZIO[R, _$12, _$13]]
def withDynamicContext[R](logger: AbstractLoggerF[[_] =>> ZIO[R, Nothing, _$20]])(dynamic: ZIO[R, Nothing, CustomContext]): LogIO2[[_, _] =>> ZIO[R, _$21, _$22]]
def withFiberId(logger: AbstractLogger): LogIO2[IO]
def withFiberId(logger: AbstractLoggerF[[_] =>> IO[Nothing, _$17]]): LogIO2[IO]