log<R, E> static method

ZIO<R, E, Unit> log<R, E>(
  1. LogLevel level,
  2. Object? message, {
  3. Map<String, dynamic>? annotations,
})

Log a message using the Logger service. It uses the loggerLayer to access the Logger.

Implementation

static ZIO<R, E, Unit> log<R, E>(
  LogLevel level,
  Object? message, {
  Map<String, dynamic>? annotations,
}) =>
    ZIO.from((ctx) => ctx
        .accessLayer<E, Logger>(loggerLayer)
        .flatMap(
          (log) => log.log(
            level,
            DateTime.now(),
            message.toString(),
            annotations: ctx
                .unsafeGetAnnotations(loggerAnnotationsSymbol)
                .addMap(annotations ?? {}),
          ),
        )
        .unsafeRun(ctx));