Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/manveru/logjam-go
Go implementation of a logjam client
https://github.com/manveru/logjam-go
Last synced: 19 days ago
JSON representation
Go implementation of a logjam client
- Host: GitHub
- URL: https://github.com/manveru/logjam-go
- Owner: manveru
- Created: 2018-08-29T13:28:20.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-10-16T17:08:04.000Z (about 6 years ago)
- Last Synced: 2024-11-05T18:51:13.639Z (2 months ago)
- Language: Go
- Size: 16.6 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# logjam-go
Please see the public repo at github.com/xing/logjam-go
## How to use it
Instal via `go get github.com/xing/logjam-go` and then inside your code create a middleware like this:```go
func logjamMiddleware(next http.Handler) http.Handler {
return logjam.NewMiddleware(next, &logjam.Options{
AppName: "MyApp",
EnvName: "production",
Logger: log.New(os.Stderr, "API", log.LstdFlags),
})
}
```Then register the middleware with your router like this:
```go
r := mux.NewRouter()
...
r.Use(logjamMiddleware)
...
```This example uses the Gorilla Mux package but it should also work with other router packages.
You also need to set environment variable to point to the actual logjam broker instance:
`export LOGJAM_BROKER=my-logjam-broker.host.name`
## Hot to contribute?
Please fork the repo and create a pull-request for us to merge.