Documentation ¶
Overview ¶
Example ¶
package main import ( "bufio" "github.com/heroku/lumbermill/Godeps/_workspace/src/github.com/bmizerany/lpx" "net/http" ) func main() { h := func(w http.ResponseWriter, r *http.Request) { lp := lpx.NewReader(bufio.NewReader(r.Body)) for lp.Next() { if string(lp.Header().Name) == "router" { decodeMsg(lp.Bytes()) } } } http.HandleFunc("/drain", h) _ = http.ListenAndServe(":8080", nil) } func decodeMsg(b []byte) { // process b }
Output:
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BytesReader ¶
type Header ¶
type Header struct { PrivalVersion []byte Time []byte Hostname []byte Name []byte Procid []byte Msgid []byte }
A Header represents a single header in a logplex entry. All fields are popluated.
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
A Reader provides sequential access to logplex packages. The Next method advances to the next entry (including the first), and then can be treated as an io.Reader to access the packages payload.
func NewReader ¶
func NewReader(r BytesReader) *Reader
NewReader creates a new Reader reading from r.
Click to show internal directories.
Click to hide internal directories.