Merge branch 'develop' into feature/docker-environment

# Conflicts:
#	.dev/vagrant/provision.sh
#	Gopkg.lock
#	Gopkg.toml
#	Vagrantfile
#	api/api.go
#	api/auth.go
#	api/handlers.go
#	api/handlers_server.go
#	api/routes.go
#	api/utils.go
#	command/root.go
#	control/docker_environment.go
#	control/server.go
#	glide.lock
#	glide.yaml
#	utils/logger.go
#	wings.go
This commit is contained in:
Jakob Schrettenbrunner
2018-05-16 10:00:07 +02:00
11 changed files with 261 additions and 170 deletions

View File

@@ -4,10 +4,11 @@ import (
"os"
"path/filepath"
"time"
//"time"
"github.com/pterodactyl/wings/constants"
"github.com/lestrrat/go-file-rotatelogs"
rotatelogs "github.com/lestrrat-go/file-rotatelogs"
"github.com/rifflock/lfshook"
log "github.com/sirupsen/logrus"
"github.com/spf13/viper"
@@ -30,12 +31,15 @@ func ConfigureLogging() error {
if err := os.MkdirAll(path, constants.DefaultFolderPerms); err != nil {
return err
}
writer := rotatelogs.New(
writer, err := rotatelogs.New(
path+"/wings.%Y%m%d-%H%M.log",
rotatelogs.WithLinkName(path),
rotatelogs.WithMaxAge(time.Duration(viper.GetInt(config.LogDeleteAfterDays))*time.Hour*24),
rotatelogs.WithRotationTime(time.Duration(604800)*time.Second),
rotatelogs.WithRotationTime(time.Hour*24),
)
if err != nil {
return err
}
log.AddHook(lfshook.NewHook(lfshook.WriterMap{
log.DebugLevel: writer,
@@ -43,7 +47,7 @@ func ConfigureLogging() error {
log.WarnLevel: writer,
log.ErrorLevel: writer,
log.FatalLevel: writer,
}))
}, &log.JSONFormatter{}))
level := viper.GetString(config.LogLevel)