Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/heroku/drain
Go library for writing Heroku drains
https://github.com/heroku/drain
Last synced: 3 months ago
JSON representation
Go library for writing Heroku drains
- Host: GitHub
- URL: https://github.com/heroku/drain
- Owner: heroku
- License: mit
- Archived: true
- Created: 2015-09-14T21:23:07.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2021-10-12T14:32:32.000Z (about 3 years ago)
- Last Synced: 2024-06-20T00:40:41.137Z (5 months ago)
- Language: Go
- Size: 3.91 KB
- Stars: 5
- Watchers: 94
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# Go library for writing Heroku drains
See [heroku/draincat](https://github.com/heroku/draincat) for example use case.
## Example
```Go
// main.go
package mainimport (
"github.com/heroku/drain"
)func main() {
drn := drain.NewDrain()
http.HandleFunc("/logs", drn.LogsHandler)
go http.ListenAndServe(":8080", nil)
for line := range drn.Logs() {
if lerr := line.Err(); lerr != nil {
fmt.Printf("Logplex error: %+v\n", lerr)
} else {
fmt.Printf("Log line: %s\n", line.Data)
}
}
}
```