mirror of
https://github.com/kataras/iris.git
synced 2025-12-21 11:57:02 +00:00
accesslog: add IP in builtin fields, change the format a bit. Default func: remove compression middleware, force-set debug log level, replace the old request logger with the accesslog one, use request id middlewareand keep recovery
This commit is contained in:
@@ -28,11 +28,13 @@ type Log struct {
|
||||
|
||||
// Request-Response latency.
|
||||
Latency time.Duration `json:"latency"`
|
||||
// The response status code.
|
||||
Code int `json:"code"`
|
||||
// Init request's Method and Path.
|
||||
Method string `json:"method"`
|
||||
Path string `json:"path"`
|
||||
// The response status code.
|
||||
Code int `json:"code"`
|
||||
// The Remote Address.
|
||||
IP string `json:"ip,omitempty"`
|
||||
// Sorted URL Query arguments.
|
||||
Query []memstore.StringEntry `json:"query,omitempty"`
|
||||
// Dynamic path parameters.
|
||||
@@ -223,7 +225,7 @@ func (f *Template) SetOutput(dest io.Writer) {
|
||||
f.dest = dest
|
||||
}
|
||||
|
||||
const defaultTmplText = "{{.Now.Format .TimeFormat}}|{{.Latency}}|{{.Method}}|{{.Path}}|{{.RequestValuesLine}}|{{.Code}}|{{.BytesReceivedLine}}|{{.BytesSentLine}}|{{.Request}}|{{.Response}}|\n"
|
||||
const defaultTmplText = "{{.Now.Format .TimeFormat}}|{{.Latency}}|{{.Code}}|{{.Method}}|{{.Path}}|{{.IP}}|{{.RequestValuesLine}}|{{.BytesReceivedLine}}|{{.BytesSentLine}}|{{.Request}}|{{.Response}}|\n"
|
||||
|
||||
// Format prints the logs in text/template format.
|
||||
func (f *Template) Format(log *Log) (bool, error) {
|
||||
|
||||
Reference in New Issue
Block a user