diff options
author | zeripath <art27@cantab.net> | 2022-06-24 11:49:47 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-24 12:49:47 +0200 |
commit | 4909493a9f75ad188f044b8577e7357f122fb445 (patch) | |
tree | 56d3c97df67b0a0846bbb9a92ebd4fb1e90ab4e4 /routers/private/manager.go | |
parent | afea63f4e5a4b7e3da03a7d5fc6590569976e7d3 (diff) | |
download | gitea-4909493a9f75ad188f044b8577e7357f122fb445.tar.gz gitea-4909493a9f75ad188f044b8577e7357f122fb445.zip |
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>
Diffstat (limited to 'routers/private/manager.go')
-rw-r--r-- | routers/private/manager.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/routers/private/manager.go b/routers/private/manager.go index a3b9a16f79..e7f08ac455 100644 --- a/routers/private/manager.go +++ b/routers/private/manager.go @@ -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") |