forked from kevadesu/forgejo
Allow manager logging to set SQL (#20064)
This PR adds a new manager command to switch on SQL logging and to turn it off. ``` gitea manager logging log-sql gitea manager logging log-sql --off ``` Signed-off-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
parent
afea63f4e5
commit
4909493a9f
6 changed files with 79 additions and 9 deletions
|
@ -68,6 +68,7 @@ func Routes() *web.Route {
|
|||
r.Post("/manager/pause-logging", PauseLogging)
|
||||
r.Post("/manager/resume-logging", ResumeLogging)
|
||||
r.Post("/manager/release-and-reopen-logging", ReleaseReopenLogging)
|
||||
r.Post("/manager/set-log-sql", SetLogSQL)
|
||||
r.Post("/manager/add-logger", bind(private.LoggerOptions{}), AddLogger)
|
||||
r.Post("/manager/remove-logger/{group}/{name}", RemoveLogger)
|
||||
r.Get("/manager/processes", Processes)
|
||||
|
|
|
@ -8,6 +8,7 @@ import (
|
|||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"code.gitea.io/gitea/models/db"
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
"code.gitea.io/gitea/modules/graceful"
|
||||
"code.gitea.io/gitea/modules/json"
|
||||
|
@ -67,6 +68,12 @@ func ReleaseReopenLogging(ctx *context.PrivateContext) {
|
|||
ctx.PlainText(http.StatusOK, "success")
|
||||
}
|
||||
|
||||
// SetLogSQL re-sets database SQL logging
|
||||
func SetLogSQL(ctx *context.PrivateContext) {
|
||||
db.SetLogSQL(ctx, ctx.FormBool("on"))
|
||||
ctx.PlainText(http.StatusOK, "success")
|
||||
}
|
||||
|
||||
// RemoveLogger removes a logger
|
||||
func RemoveLogger(ctx *context.PrivateContext) {
|
||||
group := ctx.Params("group")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue