forked from go-xorm/xorm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
syslogger.go
59 lines (44 loc) · 1.42 KB
/
syslogger.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// +build !windows,!nacl,!plan9
package xorm
import (
"fmt"
"log/syslog"
"github.com/go-xorm/core"
)
type SyslogLogger struct {
w *syslog.Writer
}
func NewSyslogLogger(w *syslog.Writer) *SyslogLogger {
return &SyslogLogger{w: w}
}
func (s *SyslogLogger) Debug(v ...interface{}) (err error) {
return s.w.Debug(fmt.Sprint(v...))
}
func (s *SyslogLogger) Debugf(format string, v ...interface{}) (err error) {
return s.w.Debug(fmt.Sprintf(format, v...))
}
func (s *SyslogLogger) Err(v ...interface{}) (err error) {
return s.w.Err(fmt.Sprint(v...))
}
func (s *SyslogLogger) Errf(format string, v ...interface{}) (err error) {
return s.w.Err(fmt.Sprintf(format, v...))
}
func (s *SyslogLogger) Info(v ...interface{}) (err error) {
return s.w.Info(fmt.Sprint(v...))
}
func (s *SyslogLogger) Infof(format string, v ...interface{}) (err error) {
return s.w.Info(fmt.Sprintf(format, v...))
}
func (s *SyslogLogger) Warning(v ...interface{}) (err error) {
return s.w.Warning(fmt.Sprint(v...))
}
func (s *SyslogLogger) Warningf(format string, v ...interface{}) (err error) {
return s.w.Warning(fmt.Sprintf(format, v...))
}
func (s *SyslogLogger) Level() core.LogLevel {
return core.LOG_UNKNOWN
}
// SetLevel always return error, as current log/syslog package doesn't allow to set priority level after syslog.Writer created
func (s *SyslogLogger) SetLevel(l core.LogLevel) (err error) {
return fmt.Errorf("unable to set syslog level")
}