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
+8.2k Android Studio : Rating bar example
+28.2k Golang : Connect to database (MySQL/MariaDB) server
+6.5k Grep : How to grep for strings inside binary data
+8.5k Golang : How to check variable or object type during runtime?
+11.1k Golang : Fix go.exe is not compatible with the version of Windows you're running
+9k Golang : Go as a script or running go with shebang/hashbang style
+13.7k Golang : Image to ASCII art example
+17.9k Golang : Login and logout a user after password verification and redirect example
+8.8k Golang : HTTP Routing with Goji example
+5.2k PHP : See installed compiled-in-modules
+7k Golang : Gargish-English language translator
+6.5k Golang : Handling image beyond OpenCV video capture boundary