Setup logging
This commit is contained in:
parent
b19eaf1007
commit
875ce167e9
5 changed files with 40 additions and 6 deletions
|
@ -1,5 +1,6 @@
|
|||
(define-module (ordo task)
|
||||
#: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
|
||||
|
@ -29,11 +30,13 @@
|
|||
(match t
|
||||
(($ <task> description condition action register triggers)
|
||||
(if (not (condition ctx))
|
||||
(format #t "SKIPPING TASK ~a (precondition not met)~%" description)
|
||||
(log-msg 'NOTICE "Skipping task: " description " (precondition not met)")
|
||||
(begin
|
||||
(format #t "RUNNING TASK ~a~%" description)
|
||||
(log-msg 'NOTICE "Running task: " description)
|
||||
(let ((result (action ctx)))
|
||||
(when register
|
||||
(log-msg 'INFO "Registering result " register)
|
||||
(register-context-var! ctx register result))
|
||||
(when triggers
|
||||
(when (and triggers (not (null? triggers)))
|
||||
(log-msg 'INFO "Scheduling triggers " triggers)
|
||||
(add-context-triggers! ctx triggers))))))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue