use define-logger

This commit is contained in:
Ryan Culpepper 2012-12-04 21:34:53 -05:00
parent fc7fa68039
commit ce567c861e
3 changed files with 20 additions and 20 deletions

View File

@ -141,7 +141,7 @@
(handle-evt (apply choice-evt keys)
;; Assignment to key has expired
(lambda (key)
(dbdebug "virtual-connection: key expiration: ~e" key)
(log-db-debug "virtual-connection: key expiration: ~e" key)
(remove! key)))))))))
;; == methods called in client thread ==
@ -253,7 +253,7 @@
[else (new-connection)])]
[proxy-number (begin0 proxy-counter (set! proxy-counter (add1 proxy-counter)))]
[c (new proxy-connection% (pool this) (connection raw-c) (number proxy-number))])
(dbdebug "connection-pool: leasing connection #~a (~a @~a)"
(log-db-debug "connection-pool: leasing connection #~a (~a @~a)"
proxy-number
(if take-idle? "idle" "new")
(hash-ref actual=>number raw-c "???"))
@ -262,7 +262,7 @@
c))
(define/private (release* proxy raw-c why)
(dbdebug "connection-pool: releasing connection #~a (~a, ~a)"
(log-db-debug "connection-pool: releasing connection #~a (~a, ~a)"
(send proxy get-number)
(cond [(not raw-c) "no-op"]
[(< (length idle-list) max-idle-connections) "idle"]

View File

@ -18,8 +18,10 @@
init-private
dblogger
dbdebug
log-db-error
log-db-warning
log-db-info
log-db-debug
(struct-out exn:fail:sql)
raise-sql-error)
@ -144,10 +146,7 @@
;; Logging
(define dblogger (make-logger 'db (current-logger)))
(define (dbdebug fmt . args)
(log-message dblogger 'debug (apply format fmt args) #f))
(define-logger db)
;; ----------------------------------------

View File

@ -318,7 +318,8 @@
(handle* who thunk (add1 iteration))]
[else
(when (> iteration 0)
(dbdebug "continuing with ~s after SQLITE_BUSY x ~s"
(log-db-debug "continuing ~s with ~s after SQLITE_BUSY x ~s"
who
(if (= s SQLITE_BUSY) "SQLITE_BUSY" s)
iteration))
(apply values (handle-status who s) rest)]))))