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
+6.6k Golang : How to determine if request or crawl is from Google robots
+7.1k Golang : Gorrila mux.Vars() function example
+28.6k Get file path of temporary file in Go
+11.1k Golang : Roll the dice example
+10.3k Golang : Embed secret text string into binary(executable) file
+13.7k Golang : Tutorial on loading GOB and PEM files
+6.3k Golang : Test input string for unicode example
+7k Golang : How to call function inside template with template.FuncMap
+6.3k Golang : Calculate US Dollar Index (DXY)
+9.7k Golang : Sort and reverse sort a slice of floats
+5.3k Golang : Get FX sentiment from website example
+9.4k Golang : Terminate-stay-resident or daemonize your program?