diff --git a/config.go b/config.go index d519d38..e25df8e 100644 --- a/config.go +++ b/config.go @@ -7,14 +7,12 @@ import ( var ( Config struct { Storage string - Env string Port int } ) func SetupConfig() { flag.StringVar(&Config.Storage, "storage", "-", "Kyoto Cabinet storage path (e.g. burlesque.kch#dfunit=8#msiz=512M)") - flag.StringVar(&Config.Env, "environment", "production", "Process environment: production or development") flag.IntVar(&Config.Port, "port", 4401, "Server HTTP port") flag.Parse() } diff --git a/logging.go b/logging.go index 3fffbe7..38a9076 100644 --- a/logging.go +++ b/logging.go @@ -13,7 +13,7 @@ var ( func SetupLogging() { logger = log.New(os.Stdout, "", log.Ldate|log.Lmicroseconds) - Log("Burlesque v%s started in %s environment", Version, Config.Env) + Log("Burlesque v%s started", Version) Log("GOMAXPROCS is set to %d", runtime.GOMAXPROCS(-1)) Log("Storage path: %s", Config.Storage) Log("Server is running at http://127.0.0.1:%d", Config.Port) @@ -23,18 +23,7 @@ func Log(format string, args ...interface{}) { logger.Printf("[INFO] "+format, args...) } -func Debug(format string, args ...interface{}) { - if Config.Env == "development" { - logger.Printf("[DEBUG] "+format, args...) - } -} - func Error(err error, format string, args ...interface{}) { logger.Printf("[ERROR] "+format, args...) - - if Config.Env == "development" { - panic(err) - } else { - logger.Printf(" %s", err.Error()) - } + logger.Printf(" %s", err.Error()) } diff --git a/server.go b/server.go index 6c18633..2e871d3 100644 --- a/server.go +++ b/server.go @@ -77,10 +77,8 @@ func PublishHandler(w http.ResponseWriter, r *http.Request) { ok := RegisterPublication(qname, msg) if ok { - Debug("Published message of %d bytes to queue %s", len(msg), qname) w.Write([]byte("OK")) } else { - Debug("Failed to publish message of %d bytes to queue %s", len(msg), qname) http.Error(w, "FAIL", 500) } } @@ -115,7 +113,6 @@ func SubscriptionHandler(w http.ResponseWriter, r *http.Request) { w.Header().Set("Queue", res.Queue) w.Write(res.Message) - Debug("Recieved message of %d bytes from queue %s", len(res.Message), res.Queue) finished <- true }