Allow LogLevel to be configurable. Also add filename and line number when LogLevel>=debug

This commit is contained in:
Deluan
2020-01-13 18:47:35 -05:00
parent c995766c45
commit 3d76144f82
4 changed files with 50 additions and 25 deletions
+5 -2
View File
@@ -4,6 +4,7 @@ import (
"fmt"
"os"
"github.com/cloudsonic/sonic-server/log"
"github.com/koding/multiconfig"
)
@@ -24,8 +25,9 @@ type sonic struct {
PlsIgnoredPatterns string `default:"^iCloud;\\~"`
// DevFlags
DevDisableAuthentication bool `default:"false"`
DevDisableFileCheck bool `default:"false"`
LogLevel string `default:"info"`
DevDisableAuthentication bool `default:"false"`
DevDisableFileCheck bool `default:"false"`
}
var Sonic *sonic
@@ -55,6 +57,7 @@ func LoadFromFile(tomlFile string) {
if err != nil {
fmt.Printf("Error loading %s: %v\n", tomlFile, err)
}
log.SetLogLevelString(Sonic.LogLevel)
}
func LoadFromLocalFile() {