summaryrefslogtreecommitdiff
path: root/ebus-racket/inserter.rkt
diff options
context:
space:
mode:
Diffstat (limited to 'ebus-racket/inserter.rkt')
-rwxr-xr-xebus-racket/inserter.rkt11
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))