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 ( 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") log.Fatal("Could not create files directory:", err)
os.Exit(1)
} }
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") log.Fatal("Could not create metadata directory:", err)
os.Exit(1)
} }
// 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") log.Fatal("Error: could not load templates", err)
os.Exit(1)
} }
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") log.Fatal("Error: could not load templates", err)
os.Exit(1)
} }
staticBox = rice.MustFindBox("static") staticBox = rice.MustFindBox("static")