diff --git a/cmd/aem/cli.go b/cmd/aem/cli.go index aba21921..e3062165 100644 --- a/cmd/aem/cli.go +++ b/cmd/aem/cli.go @@ -100,10 +100,10 @@ func (c *CLI) configure() { func (c *CLI) configureOutput() { c.outputValue = c.config.Values().Output.Value c.outputFormat = strings.ReplaceAll(c.config.Values().Output.Format, "yaml", "yml") - c.outputLogFile = c.config.Values().Output.LogFile - c.outputLogText = c.config.Values().Output.LogText + c.outputLogFile = c.config.Values().Output.Log.File + c.outputLogText = c.config.Values().Output.Log.Text - if len(c.outputValue) > 0 { + if c.outputValue != common.OutputValueNone && c.outputValue != common.OutputValueAll { c.outputFormat = fmtx.Text c.outputLogText = true } diff --git a/cmd/aem/root.go b/cmd/aem/root.go index 48bf284d..7ce10210 100644 --- a/cmd/aem/root.go +++ b/cmd/aem/root.go @@ -48,9 +48,12 @@ func (c *CLI) rootFlags(cmd *cobra.Command) { cmd.PersistentFlags().StringVar(&(c.config.Values().Output.Format), "output-format", c.config.Values().Output.Format, "Controls output format ("+strings.Join(cfg.OutputFormats(), "|")+")") - cmd.PersistentFlags().StringVar(&(c.config.Values().Output.LogFile), - "output-log-file", c.config.Values().Output.LogFile, + cmd.PersistentFlags().StringVar(&(c.config.Values().Output.Log.File), + "output-log-file", c.config.Values().Output.Log.File, "Controls output file path") + cmd.PersistentFlags().BoolVar(&(c.config.Values().Output.Log.Text), + "output-log-text", c.config.Values().Output.Log.Text, + "Write outputs and log entries to file instead of printing to console (when output format is \"text\")") cmd.PersistentFlags().StringVar(&(c.config.Values().Output.Value), "output-value", c.config.Values().Output.Value, "Limits output to single variable") diff --git a/pkg/cfg/defaults.go b/pkg/cfg/defaults.go index 89e5ce3a..ff6798ce 100644 --- a/pkg/cfg/defaults.go +++ b/pkg/cfg/defaults.go @@ -17,9 +17,9 @@ func setDefaults(v *viper.Viper) { v.SetDefault("input.format", fmtx.YML) v.SetDefault("input.file", common.STDIn) v.SetDefault("output.format", fmtx.Text) - v.SetDefault("output.log_file", common.LogFile) - v.SetDefault("output.log_text", true) v.SetDefault("output.value", common.OutputValueAll) + v.SetDefault("output.log.file", common.LogFile) + v.SetDefault("output.log.text", false) v.SetDefault("instance.processing_mode", instance.ProcessingAuto) diff --git a/pkg/cfg/values.go b/pkg/cfg/values.go index 555e903a..221e546b 100644 --- a/pkg/cfg/values.go +++ b/pkg/cfg/values.go @@ -21,10 +21,12 @@ type ConfigValues struct { } `mapstructure:"input" yaml:"input"` Output struct { - LogFile string `mapstructure:"log_file" yaml:"log_file"` - LogText bool `mapstructure:"log_text" yaml:"log_text"` - Format string `mapstructure:"format" yaml:"format"` - Value string `mapstructure:"value" yaml:"value"` + Format string `mapstructure:"format" yaml:"format"` + Value string `mapstructure:"value" yaml:"value"` + Log struct { + File string `mapstructure:"file" yaml:"file"` + Text bool `mapstructure:"text" yaml:"text"` + } `mapstructure:"log" yaml:"log"` } `mapstructure:"output" yaml:"output"` App struct { diff --git a/project/classic/aem/default/etc/aem.yml b/project/classic/aem/default/etc/aem.yml index 47f463c1..7b23efec 100755 --- a/project/classic/aem/default/etc/aem.yml +++ b/project/classic/aem/default/etc/aem.yml @@ -188,4 +188,8 @@ input: output: format: text - file: aem/home/var/log/aem.log + log: + # File path of logs written especially when output format is different than 'text' + file: aem/home/var/log/aem.log + # Controls if console output and log entries should be written to file instead of printed to console when output format is 'text' + text: false diff --git a/project/cloud/aem/default/etc/aem.yml b/project/cloud/aem/default/etc/aem.yml index 47f463c1..61c83090 100755 --- a/project/cloud/aem/default/etc/aem.yml +++ b/project/cloud/aem/default/etc/aem.yml @@ -188,4 +188,8 @@ input: output: format: text - file: aem/home/var/log/aem.log + log: + # File path of logs written especially when output format is different than 'text' + file: aem/home/var/log/aem.log + # Controls if console output and log entries should be printed to console when output format is 'text' + text: false