logging

package
Version: v0.0.72 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

A logrus adapter to the go-kit log.Logger interface.

Index

Constants

View Source
const ApacheFormatPattern = "%s - - [%s] \"%s %d %d\" %f %s\n"

Variables

View Source
var MaxFormPrefix = 256

Functions

func FormPrefix

func FormPrefix(form url.Values) string

func NewApacheLoggingHandler

func NewApacheLoggingHandler(handler http.Handler, logHandlers ...LogRecordHandler) http.Handler

func NewLogger added in v0.0.60

func NewLogger(logger logrus.FieldLogger, options ...Option) log.Logger

NewLogger returns a Go kit log.Logger that sends log events to a logrus.Logger.

func SetMaxFormPrefix added in v0.0.69

func SetMaxFormPrefix(i int)

Types

type ApacheLogRecord

type ApacheLogRecord struct {
	http.ResponseWriter `json:"-"`

	IP            string    `json:"remoteAddr,omitempty"`
	Time          time.Time `json:"time,omitempty"`
	Method        string    `json:"method,omitempty"`
	URI           string    `json:"path,omitempty"`
	Protocol      string    `json:"protocol,omitempty"`
	Status        int       `json:"status,omitempty"`
	ResponseBytes int64     `json:"responseBytes,omitempty"`
	ElapsedTime   float64   `json:"duration,omitempty"`
	FormPrefix    string    `json:"query,omitempty"`
}

func (*ApacheLogRecord) Log

func (r *ApacheLogRecord) Log(out io.Writer)

func (*ApacheLogRecord) LogJson added in v0.0.61

func (r *ApacheLogRecord) LogJson(out io.Writer)

func (*ApacheLogRecord) Write

func (r *ApacheLogRecord) Write(p []byte) (int, error)

func (*ApacheLogRecord) WriteHeader

func (r *ApacheLogRecord) WriteHeader(status int)

type ApacheLoggingHandler

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

func (*ApacheLoggingHandler) ServeHTTP

func (h *ApacheLoggingHandler) ServeHTTP(rw http.ResponseWriter, r *http.Request)

type LogRecordHandler

type LogRecordHandler func(*ApacheLogRecord)

func LogJsonToWriter added in v0.0.61

func LogJsonToWriter(out io.Writer) LogRecordHandler

func LogToWriter

func LogToWriter(out io.Writer) LogRecordHandler

type Logger added in v0.0.60

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

func (Logger) Log added in v0.0.60

func (l Logger) Log(keyvals ...interface{}) error

type Option added in v0.0.60

type Option func(*Logger)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL