diff options
author | Random Hacker <random_hacker@xapek.org> | 2012-03-04 22:30:25 +0100 |
---|---|---|
committer | Random Hacker <random_hacker@xapek.org> | 2012-03-04 22:30:25 +0100 |
commit | 3c7da220ac8f327dc2fe7fec3a2de203fdc670a0 (patch) | |
tree | 76991a19d4311815f665b40f7d273a771340146b /ebus-racket/inserter.rkt | |
parent | 78908906a5ebedba5762cb6ac392bfed651c7c7c (diff) | |
download | ebus-alt-3c7da220ac8f327dc2fe7fec3a2de203fdc670a0.tar.gz ebus-alt-3c7da220ac8f327dc2fe7fec3a2de203fdc670a0.zip |
ebus-racket: inserter.rkt Logging, fix db-insert
Diffstat (limited to 'ebus-racket/inserter.rkt')
-rwxr-xr-x | ebus-racket/inserter.rkt | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/ebus-racket/inserter.rkt b/ebus-racket/inserter.rkt index c340019..9aaca78 100755 --- a/ebus-racket/inserter.rkt +++ b/ebus-racket/inserter.rkt @@ -8,6 +8,8 @@ "layer7.rkt" "layer2.rkt") +(define logger (make-logger 'ebus-inserter (current-logger))) + (define connect-host? (make-parameter null)) (define connect-port? (make-parameter null)) (define loglevel-layer2? (make-parameter 'info)) @@ -16,10 +18,9 @@ (define (handle-fields fields) (for ([field fields]) + (log-message logger 'info (format "Field: ~a" field) #t) (when (insert?) - (apply db-insert-field field)) - (when (not (insert?)) - (display (format "Field: ~a~n" field))))) + (apply db-insert-field field)))) (define (read-ebus-loop7 input-port) (let ([fields (layer7-read-ebus (current-input-port))]) @@ -46,7 +47,7 @@ #:once-each [("-c" "--connect") host port "Connect to server <host> <port>" (connect-host? host) - (connect-port? port)] + (connect-port? (string->number port))] ["--debug-layer2" "Log level for Layer 2 Parser" (loglevel-layer2? 'debug)] ["--debug-db" "Log level for DB" @@ -63,7 +64,7 @@ (db-con-server? server)]) ;; Init Logging - (start-logger-thread (make-log-receiver (current-logger) 'info) + (start-logger-thread (make-log-receiver logger 'info) (make-log-receiver db-logger (loglevel-db?)) (make-log-receiver layer2-logger (loglevel-layer2?)) (make-log-receiver layer7-logger 'info)) |