syslog
最后更新于:2022-04-02 02:44:29
[TOC]
## syslog.Dial
```
sysLog, err := syslog.Dial("", "", syslog.LOG_ERR, "go program")
if err != nil {
log.Fatal(err)
}
defer sysLog.Close()
sysLog.Emerg("Hello world!") // Dec 27 14:23:20 mbp go program[26840]: Hello world!
sysLog.Info("hello info")
sysLog.Crit("hello Crit") // Dec 27 14:26:46 mbp go program[27251]: hello Crit
sysLog.Alert("hello Alert")
sysLog.Debug("hello debuig")
```
把日志写入系统的 `/var/log/system.log`
';