Documentation ¶
Index ¶
- Constants
- func EnableCustomBackends(backends ...ClosableBackend)
- func EnableFileLog(logPath string) error
- func EnableFileLogWithMaxAge(logPath string, maxAge time.Duration) error
- func EnableRsyslog(msgType byte, remotePort int, remotes ...string) error
- func EnableStdoutLog()
- func EnableSyslog() error
- func GinLogFormat(param gin.LogFormatterParams) string
- func RsyslogSetHostname(value string)
- func RsyslogSetThreshold(value uint32)
- type ClosableBackend
- type PrefixLogger
- func (l *PrefixLogger) Critical(args ...interface{})
- func (l *PrefixLogger) Criticalf(format string, args ...interface{})
- func (l *PrefixLogger) Debug(args ...interface{})
- func (l *PrefixLogger) Debugf(format string, args ...interface{})
- func (l *PrefixLogger) Error(args ...interface{})
- func (l *PrefixLogger) Errorf(format string, args ...interface{})
- func (l *PrefixLogger) Fatal(args ...interface{})
- func (l *PrefixLogger) Fatalf(format string, args ...interface{})
- func (l *PrefixLogger) GetPrefix() string
- func (l *PrefixLogger) Info(args ...interface{})
- func (l *PrefixLogger) Infof(format string, args ...interface{})
- func (l *PrefixLogger) Notice(args ...interface{})
- func (l *PrefixLogger) Noticef(format string, args ...interface{})
- func (l *PrefixLogger) Panic(args ...interface{})
- func (l *PrefixLogger) Panicf(format string, args ...interface{})
- func (l *PrefixLogger) UpdatePrefix(prefix string)
- func (l *PrefixLogger) Warning(args ...interface{})
- func (l *PrefixLogger) Warningf(format string, args ...interface{})
- type RSyslogWriter
Constants ¶
View Source
const ( LOG_ROTATION_INTERVAL = 24 * time.Hour // every day LOG_MAX_AGE = 365 * 24 * time.Hour // every year LOG_FORMAT = "%{time:2006-01-02 15:04:05.000} [%{level:.4s}] [%{module}] %{shortfile} %{message}" LOG_COLOR_FORMAT = "%{color}%{time:2006-01-02 15:04:05.000} [%{level:.4s}]%{color:reset} [%{module}] %{shortfile} %{message}" SYSLOG_FORMAT = "[%{level:.4s}] %{shortfile} %{message}" )
View Source
const (
SYSLOG_PRIORITY = syslog.LOG_CRIT | syslog.LOG_DAEMON
)
Variables ¶
This section is empty.
Functions ¶
func EnableCustomBackends ¶
func EnableCustomBackends(backends ...ClosableBackend)
func EnableFileLog ¶
func EnableFileLogWithMaxAge ¶
func EnableRsyslog ¶
msgType在datatype/droplet-message.go中定义 trident调用时前2个参数传入datatype.MESSAGE_TYPE_SYSLOG 和 30033
func EnableStdoutLog ¶
func EnableStdoutLog()
func EnableSyslog ¶
func EnableSyslog() error
func GinLogFormat ¶
func GinLogFormat(param gin.LogFormatterParams) string
func RsyslogSetHostname ¶
func RsyslogSetHostname(value string)
func RsyslogSetThreshold ¶
func RsyslogSetThreshold(value uint32)
Types ¶
type PrefixLogger ¶
type PrefixLogger struct { *logging.Logger // contains filtered or unexported fields }
func GetPrefixLogger ¶
func GetPrefixLogger(module, prefix string) (*PrefixLogger, error)
func WrapWithPrefixLogger ¶
func WrapWithPrefixLogger(prefix string, logger *logging.Logger) *PrefixLogger
将logger包装为前缀logger 注意需要自行将ExtraCalldepth加1,以便拿到log文件名,行号等信息
func (*PrefixLogger) Critical ¶
func (l *PrefixLogger) Critical(args ...interface{})
func (*PrefixLogger) Criticalf ¶
func (l *PrefixLogger) Criticalf(format string, args ...interface{})
func (*PrefixLogger) Debug ¶
func (l *PrefixLogger) Debug(args ...interface{})
func (*PrefixLogger) Debugf ¶
func (l *PrefixLogger) Debugf(format string, args ...interface{})
func (*PrefixLogger) Error ¶
func (l *PrefixLogger) Error(args ...interface{})
func (*PrefixLogger) Errorf ¶
func (l *PrefixLogger) Errorf(format string, args ...interface{})
func (*PrefixLogger) Fatal ¶
func (l *PrefixLogger) Fatal(args ...interface{})
func (*PrefixLogger) Fatalf ¶
func (l *PrefixLogger) Fatalf(format string, args ...interface{})
func (*PrefixLogger) GetPrefix ¶
func (l *PrefixLogger) GetPrefix() string
func (*PrefixLogger) Info ¶
func (l *PrefixLogger) Info(args ...interface{})
func (*PrefixLogger) Infof ¶
func (l *PrefixLogger) Infof(format string, args ...interface{})
func (*PrefixLogger) Notice ¶
func (l *PrefixLogger) Notice(args ...interface{})
func (*PrefixLogger) Noticef ¶
func (l *PrefixLogger) Noticef(format string, args ...interface{})
func (*PrefixLogger) Panic ¶
func (l *PrefixLogger) Panic(args ...interface{})
func (*PrefixLogger) Panicf ¶
func (l *PrefixLogger) Panicf(format string, args ...interface{})
func (*PrefixLogger) UpdatePrefix ¶
func (l *PrefixLogger) UpdatePrefix(prefix string)
func (*PrefixLogger) Warning ¶
func (l *PrefixLogger) Warning(args ...interface{})
func (*PrefixLogger) Warningf ¶
func (l *PrefixLogger) Warningf(format string, args ...interface{})
type RSyslogWriter ¶
type RSyslogWriter struct {
// contains filtered or unexported fields
}
func NewRsyslogWriter ¶
func NewRsyslogWriter(network, raddr string, tag, header string) *RSyslogWriter
func (*RSyslogWriter) Close ¶
func (w *RSyslogWriter) Close() error
Close closes a connection to the syslog daemon.
func (*RSyslogWriter) SetHostname ¶
func (w *RSyslogWriter) SetHostname(value string)
func (*RSyslogWriter) SetThreshold ¶
func (w *RSyslogWriter) SetThreshold(value uint32)
Click to show internal directories.
Click to hide internal directories.