mirror of
https://github.com/astaxie/beego.git
synced 2024-11-06 03:10:54 +00:00
Merge pull request #3535 from gadelkareem/develop
Make LogAccess() function public
This commit is contained in:
commit
3d6a68de77
@ -291,7 +291,7 @@ func (c *Controller) viewPath() string {
|
|||||||
|
|
||||||
// Redirect sends the redirection response to url with status code.
|
// Redirect sends the redirection response to url with status code.
|
||||||
func (c *Controller) Redirect(url string, code int) {
|
func (c *Controller) Redirect(url string, code int) {
|
||||||
logAccess(c.Ctx, nil, code)
|
LogAccess(c.Ctx, nil, code)
|
||||||
c.Ctx.Redirect(code, url)
|
c.Ctx.Redirect(code, url)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
error.go
2
error.go
@ -435,7 +435,7 @@ func exception(errCode string, ctx *context.Context) {
|
|||||||
|
|
||||||
func executeError(err *errorInfo, ctx *context.Context, code int) {
|
func executeError(err *errorInfo, ctx *context.Context, code int) {
|
||||||
//make sure to log the error in the access log
|
//make sure to log the error in the access log
|
||||||
logAccess(ctx, nil, code)
|
LogAccess(ctx, nil, code)
|
||||||
|
|
||||||
if err.errorType == errorTypeHandler {
|
if err.errorType == errorTypeHandler {
|
||||||
ctx.ResponseWriter.WriteHeader(code)
|
ctx.ResponseWriter.WriteHeader(code)
|
||||||
|
@ -889,7 +889,7 @@ Admin:
|
|||||||
statusCode = 200
|
statusCode = 200
|
||||||
}
|
}
|
||||||
|
|
||||||
logAccess(context, &startTime, statusCode)
|
LogAccess(context, &startTime, statusCode)
|
||||||
|
|
||||||
timeDur := time.Since(startTime)
|
timeDur := time.Since(startTime)
|
||||||
context.ResponseWriter.Elapsed = timeDur
|
context.ResponseWriter.Elapsed = timeDur
|
||||||
@ -980,7 +980,7 @@ func toURL(params map[string]string) string {
|
|||||||
return strings.TrimRight(u, "&")
|
return strings.TrimRight(u, "&")
|
||||||
}
|
}
|
||||||
|
|
||||||
func logAccess(ctx *beecontext.Context, startTime *time.Time, statusCode int) {
|
func LogAccess(ctx *beecontext.Context, startTime *time.Time, statusCode int) {
|
||||||
//Skip logging if AccessLogs config is false
|
//Skip logging if AccessLogs config is false
|
||||||
if !BConfig.Log.AccessLogs {
|
if !BConfig.Log.AccessLogs {
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user