Revert "add threshold to message"

This reverts commit 17439c2bb6.
pull/9/head
Matthew Butterick 11 years ago
parent 17439c2bb6
commit a5f57a440c

@ -16,7 +16,7 @@
(current-directory))) (current-directory)))
(define-for-syntax (command-error error-string) (define-for-syntax (command-error error-string)
`(displayln (string-append "Pollen error: ", error-string))) `(displayln (string-append "Error: ", error-string)))
(define-syntax (just-a-hook-for-the-macro stx) (define-syntax (just-a-hook-for-the-macro stx)
(if arg-command-name (if arg-command-name
@ -31,9 +31,9 @@
(parameterize ([world:current-project-root ,arg-project-directory]) (parameterize ([world:current-project-root ,arg-project-directory])
(start-server))))] (start-server))))]
[else (if (regexp-match #rx"(shit|fuck)" arg-command-name) [else (if (regexp-match #rx"(shit|fuck)" arg-command-name)
`(displayln ,(let ([responses '("Cursing at free software? Really?" "How uncouth." "Same to you, buddy.")]) (displayln (let ([responses '("Cursing at free software? Really?" "How uncouth." "Same to you, buddy.")])
(list-ref responses (random (length responses))))) (list-ref responses (random (length responses)))))
(command-error (format "unknown command '~a'" arg-command-name)))])) (command-error (format "unknown command ~a" arg-command-name)))]))
#'(begin))) #'(begin)))
(just-a-hook-for-the-macro) (just-a-hook-for-the-macro)

@ -1,6 +1,6 @@
#lang racket/base #lang racket/base
(require racket/date racket/string) (require racket/date racket/string)
(require sugar/debug sugar/define "world.rkt") (require sugar/debug sugar/define)
(provide (all-from-out sugar/debug)) (provide (all-from-out sugar/debug))
@ -61,11 +61,7 @@
(displayln (string-join `(,@(map (λ(x)(if (string? x) x (format "~v" x))) items))) (current-error-port))) (displayln (string-join `(,@(map (λ(x)(if (string? x) x (format "~v" x))) items))) (current-error-port)))
(define+provide (message . items) (define+provide (message . items)
(apply message-threshold world:threshold-normal items)) (displayln (string-join `(,(make-debug-timestamp) ,@(map (λ(x)(if (string? x) x (format "~v" x))) items))) (current-error-port)))
(define+provide (message-threshold threshold . items)
(when (threshold . <= . (world:current-message-threshold))
(displayln (string-join `(,(make-debug-timestamp) ,@(map (λ(x)(if (string? x) x (format "~v" x))) items))) (current-error-port))))
(define (exn+stack->string exn) (define (exn+stack->string exn)
(string-append (string-append

@ -57,8 +57,4 @@
(define current-module-root (make-parameter #f)) (define current-module-root (make-parameter #f))
(define current-server-extras-path (make-parameter #f)) (define current-server-extras-path (make-parameter #f))
(define threshold-silent 0)
(define threshold-normal 10)
(define threshold-debug 100)
(define current-message-threshold (make-parameter threshold-debug))

Loading…
Cancel
Save