zemirco / papertrail

Golang client for papertrail
6 stars 3 forks source link

papertrail

Send logs from your Golang apps to Papertrail.

Example

package main

import (
  "log"
  "github.com/zemirco/papertrail"
)

func main() {
  writer := papertrail.Writer{
    Port: 12345,
    Network: papertrail.UDP,
  }

  // use writer directly
  n, err := writer.Write([]byte("writer\n"))
  if err != nil {
    panic(err)
  }
  fmt.Printf("number of bytes written: %d\n", n)

  // or create a new logger
  logger := log.New(&writer, "", log.LstdFlags)
  logger.Print("logger")
}

License

MIT