mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
f2614f2107
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
68 lines
1.1 KiB
Go
68 lines
1.1 KiB
Go
package srslog
|
|
|
|
import (
|
|
"errors"
|
|
)
|
|
|
|
// Priority is a combination of the syslog facility and
|
|
// severity. For example, LOG_ALERT | LOG_FTP sends an alert severity
|
|
// message from the FTP facility. The default severity is LOG_EMERG;
|
|
// the default facility is LOG_KERN.
|
|
type Priority int
|
|
|
|
const severityMask = 0x07
|
|
const facilityMask = 0xf8
|
|
|
|
const (
|
|
// Severity.
|
|
|
|
// From /usr/include/sys/syslog.h.
|
|
// These are the same on Linux, BSD, and OS X.
|
|
LOG_EMERG Priority = iota
|
|
LOG_ALERT
|
|
LOG_CRIT
|
|
LOG_ERR
|
|
LOG_WARNING
|
|
LOG_NOTICE
|
|
LOG_INFO
|
|
LOG_DEBUG
|
|
)
|
|
|
|
const (
|
|
// Facility.
|
|
|
|
// From /usr/include/sys/syslog.h.
|
|
// These are the same up to LOG_FTP on Linux, BSD, and OS X.
|
|
LOG_KERN Priority = iota << 3
|
|
LOG_USER
|
|
LOG_MAIL
|
|
LOG_DAEMON
|
|
LOG_AUTH
|
|
LOG_SYSLOG
|
|
LOG_LPR
|
|
LOG_NEWS
|
|
LOG_UUCP
|
|
LOG_CRON
|
|
LOG_AUTHPRIV
|
|
LOG_FTP
|
|
_ // unused
|
|
_ // unused
|
|
_ // unused
|
|
_ // unused
|
|
LOG_LOCAL0
|
|
LOG_LOCAL1
|
|
LOG_LOCAL2
|
|
LOG_LOCAL3
|
|
LOG_LOCAL4
|
|
LOG_LOCAL5
|
|
LOG_LOCAL6
|
|
LOG_LOCAL7
|
|
)
|
|
|
|
func validatePriority(p Priority) error {
|
|
if p < 0 || p > LOG_LOCAL7|LOG_DEBUG {
|
|
return errors.New("log/syslog: invalid priority")
|
|
} else {
|
|
return nil
|
|
}
|
|
}
|