aboutsummaryrefslogtreecommitdiffstats
path: root/modules/context
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2023-05-22 09:38:38 +0800
committerGitHub <noreply@github.com>2023-05-22 09:38:38 +0800
commitec2a01d1e20c0d33c1ea7e362a7dfd5b653dd15f (patch)
tree8e19355b61950108a5b4a850429a19b2141d8386 /modules/context
parent2d3ebe889e7c25152821d4456b651e00fad43da1 (diff)
downloadgitea-ec2a01d1e20c0d33c1ea7e362a7dfd5b653dd15f.tar.gz
gitea-ec2a01d1e20c0d33c1ea7e362a7dfd5b653dd15f.zip
Fix regression: access log template, gitea manager cli command (#24838)
Close #24836 ![image](https://github.com/go-gitea/gitea/assets/2114189/95b025d2-f25f-4246-a08a-fe44ecb787a9) ![image](https://github.com/go-gitea/gitea/assets/2114189/c3afe1fa-2a23-420d-a016-3b67dcd04cd5)
Diffstat (limited to 'modules/context')
-rw-r--r--modules/context/access_log.go2
-rw-r--r--modules/context/response.go5
2 files changed, 6 insertions, 1 deletions
diff --git a/modules/context/access_log.go b/modules/context/access_log.go
index 9b649a6a01..373574ba14 100644
--- a/modules/context/access_log.go
+++ b/modules/context/access_log.go
@@ -92,7 +92,7 @@ func AccessLogger() func(http.Handler) http.Handler {
RequestID: &requestID,
})
if err != nil {
- log.Error("Could not set up chi access logger: %v", err.Error())
+ log.Error("Could not execute access logger template: %v", err.Error())
}
logger.Info("%s", buf.String())
diff --git a/modules/context/response.go b/modules/context/response.go
index ca52ea137d..8708d77da0 100644
--- a/modules/context/response.go
+++ b/modules/context/response.go
@@ -13,6 +13,7 @@ type ResponseWriter interface {
http.Flusher
Status() int
Before(func(ResponseWriter))
+ Size() int // used by access logger template
}
var _ ResponseWriter = &Response{}
@@ -45,6 +46,10 @@ func (r *Response) Write(bs []byte) (int, error) {
return size, nil
}
+func (r *Response) Size() int {
+ return r.written
+}
+
// WriteHeader write status code
func (r *Response) WriteHeader(statusCode int) {
if !r.beforeExecuted {