diff options
Diffstat (limited to 'pypi/logging.scm')
-rw-r--r-- | pypi/logging.scm | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/pypi/logging.scm b/pypi/logging.scm new file mode 100644 index 0000000..bd02eb9 --- /dev/null +++ b/pypi/logging.scm @@ -0,0 +1,24 @@ +(define-module (pypi logging) + #:use-module (logging logger) + #:use-module (logging port-log) + #:use-module (oop goops) + #:export (setup-logging + shutdown-logging)) + +(define (setup-logging) + (let ((lgr (make <logger>)) + (err (make <port-log> #:port (current-error-port)))) + + (disable-log-level! err 'DEBUG) + ;(disable-log-level! err 'WARN) + ;(disable-log-level! err 'INFO) + + (add-handler! lgr err) + + (set-default-logger! lgr) + (open-log! lgr))) + +(define (shutdown-logging) + (flush-log) ;; since no args, it uses the default + (close-log!) ;; since no args, it uses the default + (set-default-logger! #f)) |