quad logging

main
Matthew Butterick 6 years ago
parent 85752e9cde
commit c7151f05ff

@ -0,0 +1,8 @@
#lang racket/base
(require racket/logging)
(provide (all-defined-out))
;; creates `quad-logger` and associated functions:
;; log-quad-fatal, log-quad-error, log-quad-warning,
;; log-quad-info, and log-quad-debug
(define-logger quad)

@ -1,12 +1,16 @@
#lang debug racket
(require racket/list racket/match sugar/debug sugar/list
"param.rkt" "quad.rkt" "atomize.rkt" "position.rkt" "ocm.rkt")
"param.rkt" "quad.rkt" "atomize.rkt" "position.rkt" "ocm.rkt" "log.rkt")
(provide wrap)
(define-syntax (debug-report stx)
(syntax-case stx ()
[(_ EXPR ...) (with-syntax ([debug (datum->syntax stx 'debug)])
#'(when debug (report EXPR ...)))]))
[(_ SYM)
(with-syntax ([DEBUG (datum->syntax stx 'debug)])
#'(when DEBUG (log-quad-debug (format "~a" SYM))))]
[(_ VAL SYM)
(with-syntax ([DEBUG (datum->syntax stx 'debug)])
#'(when DEBUG (log-quad-debug (format "~a: ~a" SYM VAL))))]))
(define (nonprinting-at-start? x) (not (printable? x 'start)))
(define (nonprinting-at-end? x) (not (printable? x 'end)))

Loading…
Cancel
Save