Clean up logging on start

This commit is contained in:
George Burgess IV 2015-10-05 23:49:57 -07:00
parent c5250e529e
commit 4330d605e3

View File

@ -2,7 +2,6 @@ package main
import (
"flag"
"fmt"
"log"
"net"
"net/http"
@ -52,14 +51,12 @@ func setup() {
// make directories if needed
err := os.MkdirAll(Config.filesDir, 0755)
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)
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 '/'
@ -70,15 +67,13 @@ func setup() {
// Template setup
p2l, err := NewPongo2TemplatesLoader()
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.Globals["sitename"] = Config.siteName
err = populateTemplatesMap(TemplateSet, Templates)
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")