Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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 main

import (
"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)
}
}
}
```