1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 10:18:38 +00:00

Catch os... errors

This commit is contained in:
Bwko
2016-12-01 00:56:15 +01:00
committed by Kim "BKC" Carlbäcker
parent 5ab85372da
commit 4ff0db0246
14 changed files with 123 additions and 29 deletions

View File

@@ -42,7 +42,12 @@ func NewLogger(bufLen int64, mode, config string) {
// NewGitLogger create a logger for git
// FIXME: use same log level as other loggers.
func NewGitLogger(logPath string) {
os.MkdirAll(path.Dir(logPath), os.ModePerm)
path := path.Dir(logPath)
if err := os.MkdirAll(path, os.ModePerm); err != nil {
Fatal(4, "Fail to create dir %s: %v", path, err)
}
GitLogger = newLogger(0)
GitLogger.SetLogger("file", fmt.Sprintf(`{"level":0,"filename":"%s","rotate":false}`, logPath))
}