middleware

package
v1.8.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 8, 2021 License: Apache-2.0 Imports: 17 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultLogRowHandle added in v1.7.16

func DefaultLogRowHandle(value *freedom.LogRow) bool

DefaultLogRowHandle .

func GenerateTraceID added in v1.8.8

func GenerateTraceID() (string, error)

GenerateTraceID .

func NewBusFilter added in v1.7.9

func NewBusFilter() func(freedom.Worker)

NewBusFilter .

func NewClientPrometheus added in v1.8.4

func NewClientPrometheus(serviceName string, p prom) requests.Handler

NewClientPrometheus .

func NewRecover added in v1.6.3

func NewRecover() context.Handler

NewRecover .

func NewRequest added in v1.1.0

func NewRequest(cfg *RequestLoggerConfig) context.Handler

NewRequest .

func NewRequestLogger added in v1.6.9

func NewRequestLogger(traceIDName string, loggerConf ...*RequestLoggerConfig) func(context.Context)

NewRequestLogger .

func NewTrace

func NewTrace(traceIDName string) func(context.Context)

NewTrace .

Types

type Logger added in v1.8.8

type Logger struct {
	// contains filtered or unexported fields
}

Logger .

func NewLogger

func NewLogger(traceName, traceID string) *Logger

NewLogger .

func (*Logger) Debug added in v1.8.8

func (l *Logger) Debug(v ...interface{})

Debug will print when freedomLogger's Level is debug.

func (*Logger) Debugf added in v1.8.8

func (l *Logger) Debugf(format string, args ...interface{})

Debugf will print when freedomLogger's Level is debug.

func (*Logger) Error added in v1.8.8

func (l *Logger) Error(v ...interface{})

Error will print only when freedomLogger's Level is error, warn, info or debug.

func (*Logger) Errorf added in v1.8.8

func (l *Logger) Errorf(format string, args ...interface{})

Errorf will print only when freedomLogger's Level is error, warn, info or debug.

func (*Logger) Fatal added in v1.8.8

func (l *Logger) Fatal(v ...interface{})

Fatal `os.Exit(1)` exit no matter the level of the freedomLogger. If the freedomLogger's level is fatal, error, warn, info or debug then it will print the log message too.

func (*Logger) Fatalf added in v1.8.8

func (l *Logger) Fatalf(format string, args ...interface{})

Fatalf will `os.Exit(1)` no matter the level of the freedomLogger. If the freedomLogger's level is fatal, error, warn, info or debug then it will print the log message too.

func (*Logger) Info added in v1.8.8

func (l *Logger) Info(v ...interface{})

Info will print when freedomLogger's Level is info or debug.

func (*Logger) Infof added in v1.8.8

func (l *Logger) Infof(format string, args ...interface{})

Infof will print when freedomLogger's Level is info or debug.

func (*Logger) Log added in v1.8.8

func (l *Logger) Log(level golog.Level, v ...interface{})

Log prints a leveled log message to the output. This method can be used to use custom log levels if needed. It adds a new line in the end.

func (*Logger) Logf added in v1.8.8

func (l *Logger) Logf(level golog.Level, format string, args ...interface{})

Logf prints a leveled log message to the output. This method can be used to use custom log levels if needed. It adds a new line in the end.

func (*Logger) Print added in v1.8.8

func (l *Logger) Print(v ...interface{})

Print prints a log message without levels and colors.

func (*Logger) Printf added in v1.8.8

func (l *Logger) Printf(format string, args ...interface{})

Printf formats according to a format specifier and writes to `Printer#Output` without levels and colors.

func (*Logger) Println added in v1.8.8

func (l *Logger) Println(v ...interface{})

Println prints a log message without levels and colors. It adds a new line at the end, it overrides the `NewLine` option.

func (*Logger) Warn added in v1.8.8

func (l *Logger) Warn(v ...interface{})

Warn will print when freedomLogger's Level is warn, info or debug.

func (*Logger) Warnf added in v1.8.8

func (l *Logger) Warnf(format string, args ...interface{})

Warnf will print when freedomLogger's Level is warn, info or debug.

type RequestLoggerConfig added in v1.7.16

type RequestLoggerConfig struct {
	IP                   bool
	Query                bool
	MessageContextKeys   []string
	MessageHeaderKeys    []string
	RequestRawBody       bool
	RequestRawBodyMaxLen int64
	Title                string
	// contains filtered or unexported fields
}

RequestLoggerConfig contains the options for the logger middleware can be optionally be passed to the `New`.

func DefaultLoggerConfig added in v1.8.0

func DefaultLoggerConfig() *RequestLoggerConfig

DefaultLoggerConfig returns a default config that have all boolean fields to true except `Columns`, all strings are empty, LogFunc and Skippers to nil as well.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL