aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorNiall Sheridan <nsheridan@gmail.com>2016-06-30 22:27:28 +0100
committerNiall Sheridan <nsheridan@gmail.com>2016-06-30 22:27:28 +0100
commit6e7dfa0df6b102219817e26095f2ba636cd9288c (patch)
treebb3fa51b68e412bd5e16f579e1ea2987cfb07a87 /cmd
parente9d53ad6be24fd509fa3c735ad2ff0dfa2203bc8 (diff)
Configurable logfile location
Diffstat (limited to 'cmd')
-rw-r--r--cmd/cashierd/main.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/cmd/cashierd/main.go b/cmd/cashierd/main.go
index b91f005..8f08122 100644
--- a/cmd/cashierd/main.go
+++ b/cmd/cashierd/main.go
@@ -256,7 +256,14 @@ func main() {
r.Handle("/auth/login", appHandler{ctx, loginHandler})
r.Handle("/auth/callback", appHandler{ctx, callbackHandler})
r.Handle("/sign", appHandler{ctx, signHandler})
- h := handlers.LoggingHandler(os.Stdout, r)
+ logfile := os.Stderr
+ if config.Server.HTTPLogFile != "" {
+ logfile, err = os.OpenFile(config.Server.HTTPLogFile, os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0660)
+ if err != nil {
+ log.Fatal(err)
+ }
+ }
+ h := handlers.LoggingHandler(logfile, r)
fmt.Println("Starting server...")
l := fmt.Sprintf(":%d", config.Server.Port)