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
+20.4k Golang : Convert date string to variants of time.Time type examples
+12.3k Golang : Transform comma separated string to slice example
+9.8k Golang : Identifying Golang HTTP client request
+7.9k Golang : HttpRouter multiplexer routing example
+8.7k Golang : automatically figure out array length(size) with three dots
+31.1k Golang : How to convert(cast) string to IP address?
+32.3k Golang : Regular Expression for alphanumeric and underscore
+5.7k Facebook : How to force facebook to scrape latest URL link data?
+22.3k Generate checksum for a file in Go
+14.1k Golang : How to filter a map's elements for faster lookup
+21.4k Golang : Setting up/configure AWS credentials with official aws-sdk-go
+8.5k Golang : Gorilla web tool kit schema example