Last active
August 29, 2015 14:23
-
-
Save mbeale/7f7ae92bcc1107bcc319 to your computer and use it in GitHub Desktop.
Papertrail with Go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
// "log" | |
"log/syslog" | |
) | |
func main() { | |
pt, err := syslog.Dial("udp", "<host>.papertrailapp.com:11111", syslog.LOG_ERR, "My_App_Name") | |
if err != nil { | |
panic(err) | |
} | |
//log.SetOutput(pt) //optional if you want to send log messages to syslog | |
//log.Println("Oops. Something went wrong") | |
//standard messages | |
pt.Debug("This is a debug message") | |
pt.Alert("This is an alert message") | |
//if you want to have your own format | |
pt.Write([]byte("ERROR HTTP STATUS: 422 Message: You are missing some required fields.")) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment