Golang log/syslog.Writer.Warning() and Write() functions example
package log/syslog
Golang log/syslog.Writer.Warning() and Write() 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.Warning("warning")
logWriter.Write([]byte("Hello Logger!"))
}
References :
Advertisement
Something interesting
Tutorials
+17.6k Convert JSON to CSV in Golang
+12.7k Golang : Sort and reverse sort a slice of bytes
+6.9k Golang : Calculate BMI and risk category
+8.3k Golang : Oanda bot with Telegram and RSI example
+17k Golang : Get input from keyboard
+13.4k Golang : Increment string example
+12.7k Golang : zlib compress file example
+5k Google : Block or disable caching of your website content
+5.9k Golang : Use NLP to get sentences for each paragraph example
+7k Web : How to see your website from different countries?
+14.2k Golang : Fix image: unknown format error
+4.6k Javascript : Detect when console is activated and do something about it