summaryrefslogtreecommitdiff
path: root/ebus-racket
diff options
context:
space:
mode:
Diffstat (limited to 'ebus-racket')
-rw-r--r--ebus-racket/db.rkt2
-rwxr-xr-xebus-racket/inserter.rkt11
2 files changed, 7 insertions, 6 deletions
diff --git a/ebus-racket/db.rkt b/ebus-racket/db.rkt
index 54de8f7..f203c5b 100644
--- a/ebus-racket/db.rkt
+++ b/ebus-racket/db.rkt
@@ -73,7 +73,7 @@
(format
"sensor-id=~a type=~a value-float=~a value-int=~a value-string=~a"
sensor-id type value-float value-int value-string)) #t)
- (db:query-exec sql-stmt sensor-id type value-float value-int value-string))
+ (db:query-exec pgc sql-stmt sensor-id type value-float value-int value-string))
(provide
(prefix-out db- logger)
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))