def access
bend-kit-camber@0.15.0.1 · notices.bend:27
import bend-kit-camber@0.15.0.1/notices.bend as Notices
import Base
import bend-kit-time@0.3.0.0/time.bend as Time
import bend-kit-int@0.2.0.0/int.bend as Int
import bend-kit-notch@0.4.0.0/notch.bend as Notch
27def access(config: Access, notice: Notice) -> IO(Unit):
28 match config:
29 case Disabled{}: IO.pure(Unit, Unit{})
30 case Enabled{format}:
31 Notice{status, duration, mapped, stopped, outcome} = notice
32 Notch.info(Notch.Logger{Notch.Info{}, format, Nil{}}, "access",
33 [Notch.num("status", status), Notch.str("duration_ms", Int.I64.show(Time.Duration.to_ms(duration))),
34 Notch.flag("mapped", mapped), Notch.flag("stopped", stopped), Notch.str("outcome", outcome.name(outcome))])