1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-18 10:27:06 +00:00

more improvements to the new accesslog middleware: ability to add custom fields and change the order on the printable result

relative to: https://github.com/kataras/iris/issues/1601
This commit is contained in:
Gerasimos (Makis) Maropoulos
2020-09-07 11:35:27 +03:00
parent 4dca8f6088
commit 07806ba270
3 changed files with 183 additions and 53 deletions

View File

@@ -35,6 +35,12 @@ func main() {
Change format (after output was set):
ac.SetFormatter(&accesslog.JSON{Indent: " "})
Change the format and customize the order
with the Template format:
ac.SetFormatter(&accesslog.Template{
Text: "{{.Now.Format .TimeFormat}}|{{.Latency}}|{{.Method}}|{{.Path}}|{{.RequestValuesLine}}|{{.Code}}|{{.Request}}|{{.Response}}|\n",
})
*/
defer ac.Close()