ordo/modules/ordo/handler.scm
2025-01-10 17:22:44 +00:00

26 lines
690 B
Scheme

(define-module (ordo handler)
#:use-module (ice-9 match)
#:use-module (logging logger)
#:use-module (srfi srfi-1) ; list utils
#:use-module (srfi srfi-9) ; records
#:use-module (srfi srfi-26) ; cut
#:use-module (ordo context)
#:export (handler
handler?
handler-description
handler-action
run-handler))
(define-record-type <handler>
(make-handler description action)
handler?
(description handler-description)
(action handler-action))
(define handler make-handler)
(define (run-handler ctx h)
(match h
(($ <handler> description action)
(log-msg 'NOTICE "Running handler: " description)
(action ctx))))