Fix logging level, improved README.md

This commit is contained in:
2018-11-04 16:39:38 +01:00
parent cef5d1c3d6
commit 62d3df0725
8 changed files with 38 additions and 7 deletions

View File

@ -11,10 +11,11 @@ import (
)
func main() {
var storagePath = "./"
var storagePath = "/tmp"
if os.Getenv("DATA_DIR") != "" {
storagePath = os.Getenv("DATA_DIR")
}
logrus.Infof("Using directory: %s", storagePath)
setupLogging()
h, err := handler.NewHandler(storagePath)
if err != nil {
@ -38,10 +39,11 @@ func setupLogging() {
level := os.Getenv("LOG_LEVEL")
l := logrus.ErrorLevel
for _, ll := range logrus.AllLevels {
if strings.ToUpper(level) == string(ll) {
if strings.ToLower(level) == ll.String() {
l = ll
break
}
}
logrus.SetLevel(l)
logrus.Infof("Setting LOG_LEVEL: %s", l)
}