1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-19 10:57:05 +00:00

add an accesslog simple example

This commit is contained in:
Gerasimos (Makis) Maropoulos
2020-09-12 13:45:00 +03:00
parent 2b342a5122
commit 7d5789c3de
4 changed files with 45 additions and 5 deletions

View File

@@ -30,7 +30,6 @@ func makeAccessLog() *accesslog.AccessLog {
// Initialize a new access log middleware.
// Accepts an `io.Writer`.
ac := accesslog.New(w)
defer ac.Close()
// ac.TimeFormat = "2006-01-02 15:04:05" // default
// Example of adding more than one field to the logger.
@@ -94,11 +93,7 @@ func makeAccessLog() *accesslog.AccessLog {
func main() {
ac := makeAccessLog()
defer ac.Close()
iris.RegisterOnInterrupt(func() {
ac.Close()
})
app := iris.New()
// Register the middleware (UseRouter to catch http errors too).