Skip to content

Commit

Permalink
Allow rutime setting of bootstrap logging.audit.enabled from root /_c…
Browse files Browse the repository at this point in the history
…onfig like the other loggers
  • Loading branch information
bbrks committed Jul 2, 2024
1 parent ebe744f commit eceb115
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions base/logging_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,12 @@ func EnableStatsLogger(enabled bool) {
}
}

func EnableAuditLogger(enabled bool) {
if auditLogger != nil {
auditLogger.Enabled.Set(enabled)
}
}

// === Used by tests only ===
func ErrorLoggerIsEnabled() bool {
return errorLogger.Enabled.IsTrue()
Expand Down
5 changes: 5 additions & 0 deletions rest/admin_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,7 @@ func (h *handler) handlePutConfig() error {
Debug FileLoggerPutConfig `json:"debug,omitempty"`
Trace FileLoggerPutConfig `json:"trace,omitempty"`
Stats FileLoggerPutConfig `json:"stats,omitempty"`
Audit FileLoggerPutConfig `json:"audit,omitempty"`
} `json:"logging"`
ReplicationLimit *int `json:"max_concurrent_replications,omitempty"`
}
Expand Down Expand Up @@ -484,6 +485,10 @@ func (h *handler) handlePutConfig() error {
base.EnableStatsLogger(*config.Logging.Stats.Enabled)
}

if config.Logging.Audit.Enabled != nil {
base.EnableAuditLogger(*config.Logging.Audit.Enabled)
}

if config.ReplicationLimit != nil {
if *config.ReplicationLimit < 0 {
return base.HTTPErrorf(http.StatusBadRequest, "replication limit cannot be less than 0")
Expand Down

0 comments on commit eceb115

Please sign in to comment.