1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-20 03:17:04 +00:00

minor (see previous commit)

This commit is contained in:
Gerasimos (Makis) Maropoulos
2020-09-07 11:53:16 +03:00
parent 07806ba270
commit b063fbf3c8
3 changed files with 19 additions and 1 deletions

View File

@@ -41,6 +41,16 @@ func main() {
ac.SetFormatter(&accesslog.Template{
Text: "{{.Now.Format .TimeFormat}}|{{.Latency}}|{{.Method}}|{{.Path}}|{{.RequestValuesLine}}|{{.Code}}|{{.Request}}|{{.Response}}|\n",
})
Set custom request fields:
ac.AddField(func(ctx iris.Context) (string, interface{}) {
v := ctx.RemoteAddr()
if v == "" {
return "", nil
}
// the log entry name and its value.
return "IP", v
})
*/
defer ac.Close()