use define-logger
This commit is contained in:
parent
fc7fa68039
commit
ce567c861e
|
@ -141,7 +141,7 @@
|
||||||
(handle-evt (apply choice-evt keys)
|
(handle-evt (apply choice-evt keys)
|
||||||
;; Assignment to key has expired
|
;; Assignment to key has expired
|
||||||
(lambda (key)
|
(lambda (key)
|
||||||
(dbdebug "virtual-connection: key expiration: ~e" key)
|
(log-db-debug "virtual-connection: key expiration: ~e" key)
|
||||||
(remove! key)))))))))
|
(remove! key)))))))))
|
||||||
|
|
||||||
;; == methods called in client thread ==
|
;; == methods called in client thread ==
|
||||||
|
@ -253,7 +253,7 @@
|
||||||
[else (new-connection)])]
|
[else (new-connection)])]
|
||||||
[proxy-number (begin0 proxy-counter (set! proxy-counter (add1 proxy-counter)))]
|
[proxy-number (begin0 proxy-counter (set! proxy-counter (add1 proxy-counter)))]
|
||||||
[c (new proxy-connection% (pool this) (connection raw-c) (number proxy-number))])
|
[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
|
proxy-number
|
||||||
(if take-idle? "idle" "new")
|
(if take-idle? "idle" "new")
|
||||||
(hash-ref actual=>number raw-c "???"))
|
(hash-ref actual=>number raw-c "???"))
|
||||||
|
@ -262,7 +262,7 @@
|
||||||
c))
|
c))
|
||||||
|
|
||||||
(define/private (release* proxy raw-c why)
|
(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)
|
(send proxy get-number)
|
||||||
(cond [(not raw-c) "no-op"]
|
(cond [(not raw-c) "no-op"]
|
||||||
[(< (length idle-list) max-idle-connections) "idle"]
|
[(< (length idle-list) max-idle-connections) "idle"]
|
||||||
|
|
|
@ -18,8 +18,10 @@
|
||||||
|
|
||||||
init-private
|
init-private
|
||||||
|
|
||||||
dblogger
|
log-db-error
|
||||||
dbdebug
|
log-db-warning
|
||||||
|
log-db-info
|
||||||
|
log-db-debug
|
||||||
|
|
||||||
(struct-out exn:fail:sql)
|
(struct-out exn:fail:sql)
|
||||||
raise-sql-error)
|
raise-sql-error)
|
||||||
|
@ -144,10 +146,7 @@
|
||||||
|
|
||||||
;; Logging
|
;; Logging
|
||||||
|
|
||||||
(define dblogger (make-logger 'db (current-logger)))
|
(define-logger db)
|
||||||
|
|
||||||
(define (dbdebug fmt . args)
|
|
||||||
(log-message dblogger 'debug (apply format fmt args) #f))
|
|
||||||
|
|
||||||
;; ----------------------------------------
|
;; ----------------------------------------
|
||||||
|
|
||||||
|
|
|
@ -318,7 +318,8 @@
|
||||||
(handle* who thunk (add1 iteration))]
|
(handle* who thunk (add1 iteration))]
|
||||||
[else
|
[else
|
||||||
(when (> iteration 0)
|
(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)
|
(if (= s SQLITE_BUSY) "SQLITE_BUSY" s)
|
||||||
iteration))
|
iteration))
|
||||||
(apply values (handle-status who s) rest)]))))
|
(apply values (handle-status who s) rest)]))))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user