[MM-54319] Add AdvancedLoggingJSON setting to system console (#24733)
* Add AdvancedLoggingJSON setting to system console * Apply suggestions from code review Co-authored-by: Doug Lauder <wiggin77@warpmail.net> * Add validation for AdvancedLoggingJSON --------- Co-authored-by: Doug Lauder <wiggin77@warpmail.net> Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
0844968d81
Коммит
671cf6cc3d
@@ -1285,6 +1285,21 @@ func NewLogSettings() *LogSettings {
|
||||
return settings
|
||||
}
|
||||
|
||||
func (s *LogSettings) isValid() *AppError {
|
||||
cfg := make(mlog.LoggerConfiguration)
|
||||
err := json.Unmarshal(s.GetAdvancedLoggingConfig(), &cfg)
|
||||
if err != nil {
|
||||
return NewAppError("LogSettings.isValid", "model.config.is_valid.log.advanced_logging.json", map[string]any{"Error": err}, "", http.StatusBadRequest).Wrap(err)
|
||||
}
|
||||
|
||||
err = cfg.IsValid()
|
||||
if err != nil {
|
||||
return NewAppError("LogSettings.isValid", "model.config.is_valid.log.advanced_logging.parse", map[string]any{"Error": err}, "", http.StatusBadRequest).Wrap(err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *LogSettings) SetDefaults() {
|
||||
if s.EnableConsole == nil {
|
||||
s.EnableConsole = NewBool(true)
|
||||
@@ -3551,6 +3566,10 @@ func (o *Config) IsValid() *AppError {
|
||||
return appErr
|
||||
}
|
||||
|
||||
if appErr := o.LogSettings.isValid(); appErr != nil {
|
||||
return appErr
|
||||
}
|
||||
|
||||
if appErr := o.LocalizationSettings.isValid(); appErr != nil {
|
||||
return appErr
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user