Config option for JSON output formatter (#2843)

* Introduce a structured logging option

* rename StructuredLog to LogFormat

* add changelog entry

* move log_format under log_level
This commit is contained in:
Anton Kaliaev
2018-11-16 03:05:06 +04:00
committed by Ethan Buchman
parent b646437ec7
commit 06225e332e
5 changed files with 34 additions and 0 deletions

View File

@ -54,6 +54,9 @@ var RootCmd = &cobra.Command{
if err != nil {
return err
}
if config.LogFormat == cfg.LogFormatJSON {
logger = log.NewTMJSONLogger(log.NewSyncWriter(os.Stdout))
}
logger, err = tmflags.ParseLogLevel(config.LogLevel, logger, cfg.DefaultLogLevel())
if err != nil {
return err