Documentation
¶
Index ¶
- Constants
- Variables
- func Debug(v ...interface{})
- func Debugf(format string, v ...interface{})
- func Debugln(v ...interface{})
- func Fatal(v ...interface{})
- func Fatalf(format string, v ...interface{})
- func Fatalln(v ...interface{})
- func Panic(v ...interface{})
- func Panicf(format string, v ...interface{})
- func Panicln(v ...interface{})
- func Print(v ...interface{})
- func Printf(format string, v ...interface{})
- func Println(v ...interface{})
- type BrimLogHook
- type ContextKey
- type Credentials
- type Logger
- type LoggerConfig
- type PlainTextFormatter
Constants ¶
View Source
const ( // ContextreqIDKey is Request Context Value key for debug logging ContextreqIDKey = ContextKey("ContextreqIDKey") )
Variables ¶
View Source
var LogLevelMap = map[string]logrus.Level{ "Panic": logrus.PanicLevel, "Fatal": logrus.FatalLevel, "Error": logrus.ErrorLevel, "Warn": logrus.WarnLevel, "Info": logrus.InfoLevel, "Debug": logrus.DebugLevel, }
LogLevelMap is string map of log levels
View Source
var SyslogFacilityMap = map[string]syslog.Priority{ "LOG_KERN": syslog.LOG_KERN, "LOG_USER": syslog.LOG_USER, "LOG_MAIL": syslog.LOG_MAIL, "LOG_DAEMON": syslog.LOG_DAEMON, "LOG_AUTH": syslog.LOG_AUTH, "LOG_SYSLOG": syslog.LOG_SYSLOG, "LOG_LPR": syslog.LOG_LPR, "LOG_NEWS": syslog.LOG_NEWS, "LOG_UUCP": syslog.LOG_UUCP, "LOG_CRON": syslog.LOG_CRON, "LOG_AUTHPRIV": syslog.LOG_AUTHPRIV, "LOG_FTP": syslog.LOG_FTP, "LOG_LOCAL0": syslog.LOG_LOCAL0, "LOG_LOCAL1": syslog.LOG_LOCAL1, "LOG_LOCAL2": syslog.LOG_LOCAL2, "LOG_LOCAL3": syslog.LOG_LOCAL3, "LOG_LOCAL4": syslog.LOG_LOCAL4, "LOG_LOCAL5": syslog.LOG_LOCAL5, "LOG_LOCAL6": syslog.LOG_LOCAL6, "LOG_LOCAL7": syslog.LOG_LOCAL7, }
SyslogFacilityMap is string map of facilities
Functions ¶
Types ¶
type BrimLogHook ¶
type BrimLogHook struct { Creds Credentials `json:"Credentials"` Host string `json:"Host"` Path string `json:"Path"` }
BrimLogHook collects and sends sync events to brim api
func (*BrimLogHook) Fire ¶
func (lh *BrimLogHook) Fire(entry *logrus.Entry) (err error)
Fire for logrus.Hook interface compliance
func (*BrimLogHook) Levels ¶
func (lh *BrimLogHook) Levels() []logrus.Level
Levels for logrus.Hook interface complience
type Credentials ¶
Credentials stores brim api credentials
type Logger ¶
type Logger interface { Fatal(v ...interface{}) Fatalf(format string, v ...interface{}) Fatalln(v ...interface{}) Panic(v ...interface{}) Panicf(format string, v ...interface{}) Panicln(v ...interface{}) Print(v ...interface{}) Printf(format string, v ...interface{}) Println(v ...interface{}) Debug(v ...interface{}) Debugf(format string, v ...interface{}) Debugln(v ...interface{}) }
Logger interface generalizes Logger implementations
func NewDefaultLogger ¶
func NewDefaultLogger(config LoggerConfig, syslogFacility string, plainText bool) (Logger, error)
NewDefaultLogger return configured Logger or syslog logger
type LoggerConfig ¶
type LoggerConfig struct { Stderr bool `yaml:"stderr,omitempty"` PlainText bool `yaml:"plaintext,omitempty"` Stdout bool `yaml:"stdout,omitempty"` File string `yaml:"file"` Syslog string `yaml:"syslog"` Database sql.DBConfig `yaml:"database"` BrimAPI BrimLogHook `yaml:"brim"` Level string `yaml:"level"` }
LoggerConfig holds oprions
type PlainTextFormatter ¶
type PlainTextFormatter struct{}
PlainTextFormatter implements raw message formatting
Click to show internal directories.
Click to hide internal directories.