func Test(err os.Error, mesg string) { if err != nil { syslog, _ := syslog.New(syslog.LOG_ERR, "echo server") _, err = io.WriteString(syslog, mesg) os.Exit(-1) } }
func SetLogName(name string) { if nil != logWriter { logWriter.Close() logWriter = nil } var err os.Error logWriter, err = syslog.New(syslog.LOG_DEBUG, name) MightFail(err, "Couldn't reopen syslog") }
package orchestra import ( "fmt" "net" "os" "runtime/debug" "syslog" ) const ( DefaultMasterPort = 2258 DefaultHTTPPort = 2259 ) var logWriter, _ = syslog.New(syslog.LOG_DEBUG, "orchestra") func SetLogName(name string) { if nil != logWriter { logWriter.Close() logWriter = nil } var err os.Error logWriter, err = syslog.New(syslog.LOG_DEBUG, name) MightFail(err, "Couldn't reopen syslog") } func Debug(format string, args ...interface{}) { logWriter.Debug(fmt.Sprintf(format, args...)) }