Documentation ¶
Index ¶
- Variables
- func Alert(args ...interface{})
- func Alertf(format string, args ...interface{})
- func Alertln(args ...interface{})
- func Configure(cfg Config, defaults logrus.Fields) (io.Closer, error)
- func Debug(args ...interface{})
- func Debugf(format string, args ...interface{})
- func Debugln(args ...interface{})
- func Error(args ...interface{})
- func Errorf(format string, args ...interface{})
- func Errorln(args ...interface{})
- func Fatal(args ...interface{})
- func Fatalf(format string, args ...interface{})
- func Fatalln(args ...interface{})
- func Info(args ...interface{})
- func Infof(format string, args ...interface{})
- func Infoln(args ...interface{})
- func Log(ctx context.Context) logrus.FieldLogger
- func LogBody(next http.Handler) http.Handler
- func Panic(args ...interface{})
- func Panicf(format string, args ...interface{})
- func Panicln(args ...interface{})
- func Print(args ...interface{})
- func PrintPanics(next http.Handler) http.Handler
- func Printf(format string, args ...interface{})
- func Println(args ...interface{})
- func RedirectStderrToFile(appName string, force_redirect bool)
- func RedirectStdlogOutput(logger *logrus.Logger)
- func RequestLog(r *http.Request) logrus.FieldLogger
- func RequestLogger(logger *logrus.Logger) func(next http.Handler) http.Handler
- func SetEntryField(ctx context.Context, key string, value interface{})
- func SetEntryFields(ctx context.Context, fields map[string]interface{})
- func SetRequestEntryField(r *http.Request, key string, value interface{})
- func SetRequestEntryFields(r *http.Request, fields map[string]interface{})
- func Setup(cfg Config) (io.Closer, error)
- func Warn(args ...interface{})
- func Warnf(format string, args ...interface{})
- func Warnln(args ...interface{})
- func WithError(err error) *logrus.Entry
- func WithField(key string, value interface{}) *logrus.Entry
- func WithFields(fields logrus.Fields) *logrus.Entry
- func WithLogEntry(parent context.Context, logEntry *HTTPLoggerEntry) context.Context
- func WithLoggerContext(parent context.Context, logger *logrus.Logger) context.Context
- type BaseConfig
- type Config
- type HTTPLogger
- type HTTPLoggerEntry
- type LogstashConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var ( LoggerCtxKey = &contextKey{"Logger"} LogEntryCtxKey = &contextKey{"LogEntry"} )
View Source
var Local = logrus.New()
View Source
var Logger = logrus.New()
Functions ¶
func PrintPanics ¶
PrintPanics is a development middleware that preempts the request logger and prints a panic message and stack trace to stdout.
func RedirectStderrToFile ¶
func RedirectStdlogOutput ¶
func RequestLog ¶
func RequestLog(r *http.Request) logrus.FieldLogger
func RequestLogger ¶
RequestLogger is a middleware for the github.com/Sirupsen/logrus to log requests. It is equipt to handle recovery in case of panics and record the stack trace with a panic log-level.
func SetEntryField ¶
func SetEntryFields ¶
func SetRequestEntryField ¶
func SetRequestEntryFields ¶
func WithLogEntry ¶
func WithLogEntry(parent context.Context, logEntry *HTTPLoggerEntry) context.Context
Types ¶
type BaseConfig ¶
type Config ¶
type Config struct { Base BaseConfig `yaml:"base"` Logstash LogstashConfig `yaml:"logstash"` }
type HTTPLogger ¶
func (*HTTPLogger) NewLogEntry ¶
func (l *HTTPLogger) NewLogEntry(r *http.Request) *HTTPLoggerEntry
type HTTPLoggerEntry ¶
type HTTPLoggerEntry struct { Logger logrus.FieldLogger // field logger interface, created by RequestLogger Level *logrus.Level // intended log level to write when request finishes }
func (*HTTPLoggerEntry) Panic ¶
func (l *HTTPLoggerEntry) Panic(rec interface{}, stack []byte)
type LogstashConfig ¶
type LogstashConfig struct { Host string `yaml:"host"` TLS bool `yaml:"tls"` InsecureSkipVerify bool `yaml:"insecure_skip_verify"` }
func (LogstashConfig) Valid ¶
func (this LogstashConfig) Valid() bool
Source Files ¶
Click to show internal directories.
Click to hide internal directories.