mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 08:49:13 +00:00
feat(settings): make log level configurable from UI (#704)
* feat(settings): set log level * fix: light theme colors * fix: light theme colors size unit
This commit is contained in:
parent
8cb4a0244c
commit
ac276868fb
11 changed files with 310 additions and 30 deletions
|
@ -16,6 +16,8 @@ type configJson struct {
|
|||
Port int `json:"port"`
|
||||
LogLevel string `json:"log_level"`
|
||||
LogPath string `json:"log_path"`
|
||||
LogMaxSize int `json:"log_max_size"`
|
||||
LogMaxBackups int `json:"log_max_backups"`
|
||||
BaseURL string `json:"base_url"`
|
||||
CheckForUpdates bool `json:"check_for_updates"`
|
||||
Version string `json:"version"`
|
||||
|
@ -49,6 +51,8 @@ func (h configHandler) getConfig(w http.ResponseWriter, r *http.Request) {
|
|||
Port: h.cfg.Config.Port,
|
||||
LogLevel: h.cfg.Config.LogLevel,
|
||||
LogPath: h.cfg.Config.LogPath,
|
||||
LogMaxSize: h.cfg.Config.LogMaxSize,
|
||||
LogMaxBackups: h.cfg.Config.LogMaxBackups,
|
||||
BaseURL: h.cfg.Config.BaseURL,
|
||||
CheckForUpdates: h.cfg.Config.CheckForUpdates,
|
||||
Version: h.server.version,
|
||||
|
@ -71,6 +75,14 @@ func (h configHandler) updateConfig(w http.ResponseWriter, r *http.Request) {
|
|||
h.cfg.Config.CheckForUpdates = *data.CheckForUpdates
|
||||
}
|
||||
|
||||
if data.LogLevel != nil {
|
||||
h.cfg.Config.LogLevel = *data.LogLevel
|
||||
}
|
||||
|
||||
if data.LogPath != nil {
|
||||
h.cfg.Config.LogPath = *data.LogPath
|
||||
}
|
||||
|
||||
if err := h.cfg.UpdateConfig(); err != nil {
|
||||
render.Status(r, http.StatusInternalServerError)
|
||||
render.JSON(w, r, errorResponse{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue