Implement logger
This commit is contained in:
parent
8426126b30
commit
38115b8a57
4 changed files with 94 additions and 11 deletions
18
ordo.scm
18
ordo.scm
|
@ -8,7 +8,7 @@
|
|||
(ice-9 format)
|
||||
(ice-9 match)
|
||||
((ordo cli run) #:prefix run:)
|
||||
(srfi srfi-1))
|
||||
(ordo logger))
|
||||
|
||||
(define config
|
||||
(configuration
|
||||
|
@ -20,7 +20,7 @@
|
|||
(setting
|
||||
(name 'log-level)
|
||||
(handler string->symbol)
|
||||
(test symbol?)
|
||||
(test valid-log-level?)
|
||||
(default 'NOTICE)
|
||||
(example "DEBUG|INFO|NOTICE|WARN|ERROR")
|
||||
(synopsis "Log level"))))
|
||||
|
@ -36,7 +36,13 @@
|
|||
|
||||
(define (main cmd-line)
|
||||
(let ((options (getopt-config-auto cmd-line config)))
|
||||
(match (full-command options)
|
||||
(("ordo" "run")
|
||||
(run:handler options))
|
||||
(_ (emit-help options)))))
|
||||
(dynamic-wind
|
||||
(lambda ()
|
||||
(setup-logging! #:level (option-ref options 'log-level)))
|
||||
(lambda ()
|
||||
(match (full-command options)
|
||||
(("ordo" "run")
|
||||
(run:handler options))
|
||||
(_ (emit-help options))))
|
||||
(lambda ()
|
||||
(shutdown-logging!)))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue