middleware

package
v1.8.11 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 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 The middleware output of the log line .

func GenerateTraceID added in v1.8.8

func GenerateTraceID() (string, error)

GenerateTraceID Build a unique ID.

func NewBusFilter added in v1.7.9

func NewBusFilter() func(freedom.Worker)

NewBusFilter Worker's middleware, filtering HTTP Header.

func NewClientPrometheus added in v1.8.4

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

NewClientPrometheus HTTP Client middleware that monitors requests made.

func NewRecover added in v1.6.3

func NewRecover() context.Handler

NewRecover Request recover.

func NewRequestLogger added in v1.6.9

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

NewRequestLogger . Request the log. The name of the incoming trace, taken out of HTTP Header.

func NewTrace

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

NewTrace The default HTTP Trace.

Types

type Logger added in v1.8.8

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

Logger The implementation of Logger..

func NewLogger

func NewLogger(traceName, traceID string) *Logger

NewLogger Create a Loger. The name and value of the incoming Trace. Requests should have their own Loger.

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