mirror of
https://github.com/anchore/syft.git
synced 2025-11-17 16:33:21 +01:00
* use SYFT_LOG_FILE Signed-off-by: Jonas Galvão Xavier <jonas.agx@gmail.com> * enable debug logs when SYFT_LOG_FILE is set Signed-off-by: Jonas Galvão Xavier <jonas.agx@gmail.com> * set log.file and add tests Signed-off-by: Jonas Galvão Xavier <jonas.agx@gmail.com> * test log file in temp directory Signed-off-by: Jonas Galvão Xavier <jonas.agx@gmail.com> * add note on binding refactor Signed-off-by: Jonas Galvão Xavier <jonas.agx@gmail.com> * remove unused function Signed-off-by: Jonas Galvão Xavier <jonas.agx@gmail.com>
20 lines
874 B
Go
20 lines
874 B
Go
package config
|
|
|
|
import (
|
|
"github.com/sirupsen/logrus"
|
|
"github.com/spf13/viper"
|
|
)
|
|
|
|
// logging contains all logging-related configuration options available to the user via the application config.
|
|
type logging struct {
|
|
Structured bool `yaml:"structured" json:"structured" mapstructure:"structured"` // show all log entries as JSON formatted strings
|
|
LevelOpt logrus.Level `yaml:"-" json:"-"` // the native log level object used by the logger
|
|
Level string `yaml:"level" json:"level" mapstructure:"level"` // the log level string hint
|
|
FileLocation string `yaml:"file" json:"file-location" mapstructure:"file"` // the file path to write logs to
|
|
}
|
|
|
|
func (cfg logging) loadDefaultValues(v *viper.Viper) {
|
|
v.SetDefault("log.structured", false)
|
|
v.SetDefault("log.file", "")
|
|
}
|