Browse Source

Clean up logging on start

pull/41/head
George Burgess IV 9 years ago
parent
commit
4330d605e3
  1. 13
      server.go

13
server.go

@ -2,7 +2,6 @@ package main
import ( import (
"flag" "flag"
"fmt"
"log" "log"
"net" "net"
"net/http" "net/http"
@ -52,14 +51,12 @@ func setup() {
// make directories if needed // make directories if needed
err := os.MkdirAll(Config.filesDir, 0755) err := os.MkdirAll(Config.filesDir, 0755)
if err != nil { if err != nil {
fmt.Println("Error: could not create files directory")
os.Exit(1)
log.Fatal("Could not create files directory:", err)
} }
err = os.MkdirAll(Config.metaDir, 0700) err = os.MkdirAll(Config.metaDir, 0700)
if err != nil { if err != nil {
fmt.Println("Error: could not create metadata directory")
os.Exit(1)
log.Fatal("Could not create metadata directory:", err)
} }
// ensure siteURL ends wth '/' // ensure siteURL ends wth '/'
@ -70,15 +67,13 @@ func setup() {
// Template setup // Template setup
p2l, err := NewPongo2TemplatesLoader() p2l, err := NewPongo2TemplatesLoader()
if err != nil { if err != nil {
fmt.Println("Error: could not load templates")
os.Exit(1)
log.Fatal("Error: could not load templates", err)
} }
TemplateSet := pongo2.NewSet("templates", p2l) TemplateSet := pongo2.NewSet("templates", p2l)
TemplateSet.Globals["sitename"] = Config.siteName TemplateSet.Globals["sitename"] = Config.siteName
err = populateTemplatesMap(TemplateSet, Templates) err = populateTemplatesMap(TemplateSet, Templates)
if err != nil { if err != nil {
fmt.Println("Error: could not load templates")
os.Exit(1)
log.Fatal("Error: could not load templates", err)
} }
staticBox = rice.MustFindBox("static") staticBox = rice.MustFindBox("static")

Loading…
Cancel
Save