Skip to content
This repository has been archived by the owner on Mar 14, 2022. It is now read-only.

Commit

Permalink
Added basic docs
Browse files Browse the repository at this point in the history
  • Loading branch information
italolelis committed Apr 23, 2018
1 parent 190a17b commit 3f57381
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,41 @@ func main() {
}
```

### Track requests metrics with middleware

```go
package main

import (
"net/http"

"github.com/go-chi/chi"
"github.com/hellofresh/logging-go/middleware"
)

func main() {
appConfig, err := LoadAppConfig()
if nil != err {
panic(err)
}

err = appConfig.Log.Apply()
if nil != err {
panic(err)
}
defer appConfig.Log.Flush()

r := chi.NewRouter()
r.Use(middleware.New())

r.GET("/", func(c *gin.Context) {
c.JSON(http.StatusOK, "I'm producing logs!")
})

http.ListenAndServe(":8080", r)
}
```

## Configuration

### Base logger
Expand Down

0 comments on commit 3f57381

Please sign in to comment.