Documentation
¶
Index ¶
- func FilteredRequestLogger(f middleware.LogFormatter, urlRegEx *regexp.Regexp) func(next http.Handler) http.Handler
- func NewFilteredRequestLogger(filterOut *regexp.Regexp) func(next http.Handler) http.Handler
- type Logger
- type LoggingConfig
- type LoggingOption
- func WithFormatter(formatter middleware.LogFormatter) LoggingOption
- func WithLogger(logger Logger) LoggingOption
- func WithNoColor(noColor bool) LoggingOption
- func WithOutput(output io.Writer) LoggingOption
- func WithRegexFilter(pattern *regexp.Regexp) LoggingOption
- func WithURLFilter(filter URLFilter) LoggingOption
- type RegexURLFilter
- type RequestLogger
- type URLFilter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FilteredRequestLogger ¶
func FilteredRequestLogger(f middleware.LogFormatter, urlRegEx *regexp.Regexp) func(next http.Handler) http.Handler
FilteredRequestLogger is a copy of the middleware.RequestLogger function - But with a reg-ex to filter & exclude URLs from logging
Types ¶
type Logger ¶ added in v0.0.3
type Logger interface {
Printf(format string, v ...interface{})
Println(v ...interface{})
}
Logger defines the interface for logging operations
type LoggingConfig ¶ added in v0.0.3
type LoggingConfig struct {
Logger Logger
Formatter middleware.LogFormatter
URLFilter URLFilter
NoColor bool
Output io.Writer
}
LoggingConfig holds configuration for request logging
func DefaultLoggingConfig ¶ added in v0.0.3
func DefaultLoggingConfig() *LoggingConfig
DefaultLoggingConfig provides sensible defaults
func NewLoggingConfig ¶ added in v0.0.3
func NewLoggingConfig(options ...LoggingOption) *LoggingConfig
NewLoggingConfig creates a new logging config with options
type LoggingOption ¶ added in v0.0.3
type LoggingOption func(*LoggingConfig)
LoggingOption is a functional option for logging configuration
func WithFormatter ¶ added in v0.0.3
func WithFormatter(formatter middleware.LogFormatter) LoggingOption
WithFormatter sets a custom log formatter
func WithLogger ¶ added in v0.0.3
func WithLogger(logger Logger) LoggingOption
WithLogger sets a custom logger
func WithNoColor ¶ added in v0.0.3
func WithNoColor(noColor bool) LoggingOption
WithNoColor disables color output
func WithOutput ¶ added in v0.0.3
func WithOutput(output io.Writer) LoggingOption
WithOutput sets the output writer
func WithRegexFilter ¶ added in v0.0.3
func WithRegexFilter(pattern *regexp.Regexp) LoggingOption
WithRegexFilter sets a regex-based URL filter
func WithURLFilter ¶ added in v0.0.3
func WithURLFilter(filter URLFilter) LoggingOption
WithURLFilter sets a custom URL filter
type RegexURLFilter ¶ added in v0.0.3
type RegexURLFilter struct {
// contains filtered or unexported fields
}
RegexURLFilter implements URLFilter using regex patterns
func (*RegexURLFilter) ShouldFilter ¶ added in v0.0.3
func (f *RegexURLFilter) ShouldFilter(url string) bool
ShouldFilter checks if the URL should be filtered
type RequestLogger ¶ added in v0.0.3
type RequestLogger struct {
// contains filtered or unexported fields
}
RequestLogger handles HTTP request logging with configuration
func NewRequestLogger ¶ added in v0.0.3
func NewRequestLogger(options ...LoggingOption) *RequestLogger
NewRequestLogger creates a new request logger with options
func (*RequestLogger) Middleware ¶ added in v0.0.3
func (rl *RequestLogger) Middleware() func(next http.Handler) http.Handler
Middleware returns the logging middleware function