1 // (c) Bernhard Tittelbach, 2013
9 type NullWriter struct {}
10 func (n *NullWriter) Write(p []byte) (int, error) {return len(p),nil}
18 Syslog_ = log.New(&NullWriter{}, "", 0)
19 Debug_ = log.New(&NullWriter{}, "", 0)
22 func LogEnableSyslog() {
24 Syslog_, logerr = syslog.NewLogger(syslog.LOG_INFO | (18<<3), 0)
25 if logerr != nil { panic(logerr) }
28 func LogEnableDebuglog() {
29 Syslog_ = log.New(os.Stdout, "", log.LstdFlags)
30 Debug_ = log.New(os.Stderr, "DEBUG ", log.LstdFlags)
33 type XMPPLogger struct {
36 func (s *XMPPLogger) Log(v ...interface{}) {
40 func (s *XMPPLogger) Logf(fmt string, v ...interface{}) {
41 Syslog_.Printf(fmt, v...)
44 type XMPPDebugLogger struct {
47 func (s *XMPPDebugLogger) Log(v ...interface{}) {
51 func (s *XMPPDebugLogger) Logf(fmt string, v ...interface{}) {
52 Debug_.Printf(fmt, v...)