9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
;; PURPOSE.
;;======================================================================
(use trace)
(define (debug:calc-verbosity vstr)
(cond
((string-match "^\\s*$" vstr) #f)
(vstr (let ((debugvals (string-split vstr ",")))
(cond
((> (length debugvals) 1)(map string->number debugvals))
((> (length debugvals) 0)(string->number (car debugvals)))
(else #f))))
((args:get-arg "-v") 2)
((args:get-arg "-q") 0)
(else 1)))
|
>
|
|
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
;; PURPOSE.
;;======================================================================
(use trace)
(define (debug:calc-verbosity vstr)
(cond
((not vstr) #f)
((string-match "^\\s*$" vstr) #f)
(vstr (let ((debugvals (string-split vstr ",")))
(cond
((> (length debugvals) 1)(map string->number debugvals))
((> (length debugvals) 0)(string->number (car debugvals)))
(else #f))))
((args:get-arg "-v") 2)
((args:get-arg "-q") 0)
(else 1)))
|
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
(define (debug:print n . params)
(if (debug:debug-mode n)
(with-output-to-port (current-error-port)
(lambda ()
(if *logging*
(db:log-event (apply conc params))
(apply print params)
)))))
(define (debug:print-info n . params)
(if (debug:debug-mode n)
(with-output-to-port (current-error-port)
(lambda ()
(let ((res (format#format #f "INFO: (~2d) ~a" n (apply conc params))))
(if *logging*
(db:log-event res)
(apply print "INFO: (" n ") " params) ;; res)
))))))
;; if a value is printable (i.e. string or number) return the value
;; else return an empty string
(define-inline (printable val)
(if (or (number? val)(string? val)) val ""))
|
|
|
|
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
(define (debug:print n . params)
(if (debug:debug-mode n)
(with-output-to-port (current-error-port)
(lambda ()
(if *logging*
(db:log-event (apply conc params))
(apply print "pid:" (current-process-id) " " params)
)))))
(define (debug:print-info n . params)
(if (debug:debug-mode n)
(with-output-to-port (current-error-port)
(lambda ()
(let ((res (format#format #f "INFO: (~2d) ~a" n (apply conc params))))
(if *logging*
(db:log-event res)
(apply print "pid:" (current-process-id) " " "INFO: (" n ") " params) ;; res)
))))))
;; if a value is printable (i.e. string or number) return the value
;; else return an empty string
(define-inline (printable val)
(if (or (number? val)(string? val)) val ""))
|