From 64f0703c67d17ce61a2917f770cbcf1bc1a13520 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20B=C3=B6hm?= Date: Tue, 29 Jul 2014 20:23:45 +0200 Subject: [PATCH] Added --verbose flag and logging for backend --- backend.go | 4 ++++ bindata.go | 14 ++++++-------- ddns.go | 4 ++++ 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/backend.go b/backend.go index 3341cb0..36a195d 100644 --- a/backend.go +++ b/backend.go @@ -27,6 +27,10 @@ func RunBackend(conn *RedisConnection) { func HandleRequest(line string, conn *RedisConnection) { defer fmt.Printf("END\n") + if Verbose { + fmt.Printf("LOG\t'%s'\n", line) + } + parts := strings.Split(line, "\t") if len(parts) != 6 { return diff --git a/bindata.go b/bindata.go index 92ee01e..ef5989b 100644 --- a/bindata.go +++ b/bindata.go @@ -1,10 +1,10 @@ package main import ( - "bytes" - "compress/gzip" - "fmt" - "io" + "bytes" + "compress/gzip" + "fmt" + "io" ) func bindata_read(data []byte, name string) ([]byte, error) { @@ -204,12 +204,11 @@ func templates_index_html() ([]byte, error) { 0xc0, 0xd0, 0x7b, 0xb7, 0xa7, 0x8e, 0xc3, 0xf2, 0x32, 0x37, 0x0e, 0xcb, 0x7f, 0xf4, 0xfa, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x7f, 0x06, 0x0e, 0xd9, 0x05, 0x1b, 0x00, 0x00, - }, + }, "templates/index.html", ) } - // Asset loads and returns the asset for the given name. // It returns an error if the asset could not be found or // could not be loaded. @@ -221,7 +220,6 @@ func Asset(name string) ([]byte, error) { } // _bindata is a table, holding each asset generator, mapped to its name. -var _bindata = map[string] func() ([]byte, error) { +var _bindata = map[string]func() ([]byte, error){ "templates/index.html": templates_index_html, - } diff --git a/ddns.go b/ddns.go index 01a8a39..f4a88d4 100644 --- a/ddns.go +++ b/ddns.go @@ -16,6 +16,7 @@ var ( DdnsDomain string DdnsWebListenSocket string DdnsRedisHost string + Verbose bool ) func init() { @@ -27,6 +28,9 @@ func init() { flag.StringVar(&DdnsRedisHost, "redis", ":6379", "The Redis socket that should be used") + + flag.BoolVar(&Verbose, "verbose", false, + "Be more verbose") } func ValidateCommandArgs() {