effectful_logger 0.2.1

Effect-logging service (forwards to tracing) for effect! / AsyncEffect programs
Documentation

Injectable [EffectLogger] service for the effect system.

Service/Tag pattern

Extract the logger from the environment once with bind* EffectLogger, then call its methods as regular effectful steps:

effect!(|_r: &mut R| {
    let logger = bind* EffectLogger;
    bind* logger.warn("something suspicious");
    bind* logger.info("all good");
    result
})

The environment R only needs to satisfy R: Get<EffectLogKey, Here, Target = EffectLogger>. The caller composes layers at the top of the program. For a minimal stack that only provides [EffectLogger], build Context::new(Cons(layer_effect_logger().build().expect(\"…\"), Nil)) or Context::new(Cons(Service::<EffectLogKey, _>::new(EffectLogger), Nil)) at the program edge.

Log methods accept impl Into<Cow<'static, str>>: literals stay zero-copy; runtime text passes as String or format!(...).