logger
This commit is contained in:
parent
2ff238d5f8
commit
c00b1abd72
1 changed files with 5 additions and 0 deletions
|
@ -60,6 +60,7 @@ type WaapRuntimeConfig struct {
|
||||||
CompiledOnMatch []Hook
|
CompiledOnMatch []Hook
|
||||||
CompiledVariablesTracking []*regexp.Regexp
|
CompiledVariablesTracking []*regexp.Regexp
|
||||||
Config *WaapConfig
|
Config *WaapConfig
|
||||||
|
//CorazaLogger debuglog.Logger
|
||||||
|
|
||||||
//those are ephemeral, created/destroyed with every req
|
//those are ephemeral, created/destroyed with every req
|
||||||
OutOfBandTx ExtendedTransaction //is it a good idea ?
|
OutOfBandTx ExtendedTransaction //is it a good idea ?
|
||||||
|
@ -80,6 +81,7 @@ type WaapConfig struct {
|
||||||
PreEval []Hook `yaml:"pre_eval"`
|
PreEval []Hook `yaml:"pre_eval"`
|
||||||
OnMatch []Hook `yaml:"on_match"`
|
OnMatch []Hook `yaml:"on_match"`
|
||||||
VariablesTracking []string `yaml:"variables_tracking"`
|
VariablesTracking []string `yaml:"variables_tracking"`
|
||||||
|
LogLevel log.Level `yaml:"log_level"`
|
||||||
Logger *log.Entry `yaml:"-"`
|
Logger *log.Entry `yaml:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,9 +106,12 @@ func (wc *WaapConfig) Load(file string) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("unable to parse yaml file %s : %s", file, err)
|
return fmt.Errorf("unable to parse yaml file %s : %s", file, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if wc.Name == "" {
|
if wc.Name == "" {
|
||||||
return fmt.Errorf("name cannot be empty")
|
return fmt.Errorf("name cannot be empty")
|
||||||
}
|
}
|
||||||
|
wc.Logger = wc.Logger.WithField("name", wc.Name)
|
||||||
|
wc.Logger.Logger.SetLevel(wc.LogLevel)
|
||||||
if wc.DefaultRemediation == "" {
|
if wc.DefaultRemediation == "" {
|
||||||
return fmt.Errorf("default_remediation cannot be empty")
|
return fmt.Errorf("default_remediation cannot be empty")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue