Add config option to strip (most) colors from console logs

This commit is contained in:
ctdk
2015-10-01 13:16:23 -07:00
parent 7dc923a292
commit d37e18fdcf
3 changed files with 15 additions and 7 deletions
+6 -2
View File
@@ -140,7 +140,7 @@ type CommandLineArgs struct {
func init() {
IsWindows = runtime.GOOS == "windows"
log.NewLogger(0, "console", `{"level": 0}`)
log.NewLogger(0, "console", `{"level": 0, "formatting":true}`)
}
func parseAppUrlAndSubUrl(section *ini.Section) (string, string) {
@@ -527,7 +527,11 @@ func initLogging(args *CommandLineArgs) {
// Generate log configuration.
switch mode {
case "console":
LogConfigs[i] = util.DynMap{"level": level}
formatting := sec.Key("formatting").MustBool(true)
LogConfigs[i] = util.DynMap{
"level": level,
"formatting": formatting,
}
case "file":
logPath := sec.Key("file_name").MustString(filepath.Join(LogsPath, "grafana.log"))
os.MkdirAll(filepath.Dir(logPath), os.ModePerm)