general improvements

This commit is contained in:
ston1th 2018-10-27 21:28:19 +02:00
commit ddb11f0619
25 changed files with 305 additions and 140 deletions

View file

@ -4,6 +4,7 @@ package log
import (
"git.giftfish.de/ston1th/godrop/v2"
"git.giftfish.de/ston1th/gowiki/pkg/core"
stdlog "log"
"os"
"path/filepath"
@ -14,12 +15,12 @@ var (
debug = false
)
func InitLogger(dir, file string, d bool) {
debug = d
if file == "-" {
func InitLogger(cfg core.Config) {
debug = cfg.Debug
if cfg.LogFile == "-" {
return
}
logfile := filepath.Join(dir, file)
logfile := filepath.Join(cfg.DataDir, cfg.LogFile)
err := godrop.Unveil(logfile, "rwc")
if err != nil {
stdlog.Fatal(err)