Clean up logging on start
This commit is contained in:
parent
c5250e529e
commit
4330d605e3
13
server.go
13
server.go
|
@ -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")
|
||||
|
|
Loading…
Reference in New Issue