summaryrefslogtreecommitdiff
path: root/ebus-racket/inserter.rkt
diff options
context:
space:
mode:
authorEbus-at-dockstar <ebus@dockstar>2014-07-26 20:34:34 +0200
committerEbus-at-dockstar <ebus@dockstar>2014-07-26 20:34:34 +0200
commitb04b3062e94c95578c4ec0436d86c9803b86b3f2 (patch)
tree17ae8e261dcbe279d6596d7d399406281dfb9815 /ebus-racket/inserter.rkt
parent99c6eb21eb7ff9a072b87d9d64324871ea7201f1 (diff)
downloadebus-alt-b04b3062e94c95578c4ec0436d86c9803b86b3f2.tar.gz
ebus-alt-b04b3062e94c95578c4ec0436d86c9803b86b3f2.zip
changed logging
Diffstat (limited to 'ebus-racket/inserter.rkt')
-rwxr-xr-xebus-racket/inserter.rkt21
1 files changed, 10 insertions, 11 deletions
diff --git a/ebus-racket/inserter.rkt b/ebus-racket/inserter.rkt
index 90ae258..ab97ecf 100755
--- a/ebus-racket/inserter.rkt
+++ b/ebus-racket/inserter.rkt
@@ -8,8 +8,7 @@
"util/tcp-repl.rkt"
"util/json.rkt")
-(define logger (make-logger 'ebus-inserter (current-logger)))
-(current-logger logger)
+(define-logger inserter)
(define connect-host? (make-parameter null))
(define connect-port? (make-parameter null))
@@ -29,21 +28,21 @@
(string->bytes/utf-8 (format "value=~a&type=~a" value type)))))
(define responseJson (string->jsexpr response))
(cond ((eq? (json-null) (hash-ref responseJson 'error))
- (log-debug "Successful insert: type=~a value=~a"
+ (log-inserter-debug "Successful insert: type=~a value=~a"
type value))
- (else (log-error "Error: type=~a value=~a ERROR:~a"
+ (else (log-inserter-error "Error: type=~a value=~a ERROR:~a"
type value response))))
(define (handle-packet packet)
(for ([field packet])
- (log-info "Field: ~a" field)
+ (log-inserter-info "Field: ~a" field)
(when (insert?)
(with-handlers ([exn:fail? (lambda (exn)
- (log-error "Failed to insert ~a: ~a" field exn))]
+ (log-inserter-error "Failed to insert ~a: ~a" field exn))]
[exn:fail:read? (lambda (exn)
- (log-error "TCP Read exception ~a" exn))]
+ (log-inserter-error "TCP Read exception ~a" exn))]
[exn:fail:network? (lambda (exn)
- (log-error "TCP Exception ~a" exn))])
+ (log-inserter-error "TCP Exception ~a" exn))])
(apply insert-field field)))))
(define-namespace-anchor repl-ns-anchor)
@@ -64,9 +63,9 @@
;; Connect, replacing input with tcp connection
(if (or (null? (connect-host?)) (null? (connect-port?)))
- (log-info "Using stdin")
+ (log-inserter-info "Using stdin")
(let-values ([(cin cout) (tcp-connect (connect-host?) (connect-port?))])
- (log-info "Connected to ~s ~s ~n" (connect-host?) (connect-port?))
+ (log-inserter-info "Connected to ~s ~s ~n" (connect-host?) (connect-port?))
(current-input-port cin)))
;; Process Ebus Packets
@@ -78,7 +77,7 @@
(define (make-stream port)
(stream-cons (with-handlers ([exn:fail? (lambda (exn)
- (log-error "Failed to parse paket: ~a" exn)
+ (log-inserter-error "Failed to parse paket: ~a" exn)
(void))])
(layer7-read-ebus port))
(make-stream port)))