func SetupLog() error {
	logger, err := log.NewStdErr(log.PrefixDateTime)
	if err != nil {
		return err
	}
	log.Add(logger)
	fileLog, err := log.NewFile(config.Get("log"))
	if err != nil {
		return err
	}
	log.Add(fileLog)
	return nil
}
SetupLog sets up logging
package app
import (
	"os"
	"path/filepath"
	"strings"
	"time"
	"github.com/fragmenta/assets"
	"github.com/fragmenta/query"
	"github.com/fragmenta/server/config"
	"github.com/fragmenta/server/log"
	"github.com/fragmenta/view"
	"github.com/fragmenta/fragmenta-cms/src/lib/mail"
	"github.com/fragmenta/fragmenta-cms/src/lib/mail/adapters/sendgrid"
)
var appAssets *assets.Collection
func Setup() {
	err := SetupLog()
	if err != nil {
		println("failed to set up logs %s", err)
		os.Exit(1)
	}
	msg := "Starting server"
	if config.Production() {
		msg = msg + " in production"
	}
	log.Info(log.Values{"msg": msg, "port": config.Get("port")})
	defer log.Time(time.Now(), log.Values{"msg": "Finished loading server"})
	SetupMail()
	SetupAssets()
	SetupView()
	SetupDatabase()
	SetupAuth()
	SetupRoutes()
}
func SetupDatabase() {
	defer log.Time(time.Now(), log.V{"msg": "Finished opening database", "db": config.Get("db"), "user": config.Get("db_user")})
	options := map[string]string{
		"adapter":  config.Get("db_adapter"),
		"user":     config.Get("db_user"),
		"password": config.Get("db_pass"),
		"db":       config.Get("db"),
	}
	if len(config.Get("db_host")) > 0 {
		options["host"] = config.Get("db_host")
	}
	if len(config.Get("db_port")) > 0 {
		options["port"] = config.Get("db_port")
	}
	if len(config.Get("db_params")) > 0 {
		options["params"] = config.Get("db_params")
	}
	err := query.OpenDatabase(options)
	if err != nil {
		log.Fatal(log.V{"msg": "unable to read database", "db": config.Get("db"), "error": err})
		os.Exit(1)
	}
}