Golang log/syslog.Writer.Err(), Info() and Notice() functions example
package log/syslog
Golang log/syslog.Writer.Err(), Info() and Notice() functions usage example
package main
import (
"log"
"log/syslog"
)
func main() {
// connection to a log on localhost
// change localhost to remote server IP address if you want the log message
// to be sent to the remote server
logWriter, err := syslog.Dial("udp", "localhost", syslog.LOG_ERR, "Error logger")
defer logWriter.Close()
if err != nil {
log.Fatal("error")
}
logWriter.Err("error")
logWriter.Notice("notice")
logWriter.Info("information")
logWriter.Write([]byte("Hello Logger!"))
}
References :
http://golang.org/pkg/log/syslog/#Writer.Err
Advertisement
Something interesting
Tutorials
+15.7k Golang : Intercept Ctrl-C interrupt or kill signal and determine the signal type
+26k Golang : Convert IP address string to long ( unsigned 32-bit integer )
+9.7k Golang : Find correlation coefficient example
+10.6k Golang : Get local time and equivalent time in different time zone
+6k Golang : How to verify input is rune?
+13.4k Golang : Verify token from Google Authenticator App
+18.6k Golang : Get download file size
+6.7k Golang : Humanize and Titleize functions
+14.2k Elastic Search : Mapping date format and sort by date
+24.1k Golang : Upload to S3 with official aws-sdk-go package
+18.2k Golang : Get command line arguments
+23.9k Golang : Fix type interface{} has no field or no methods and type assertions example