util

package
Version: v0.0.0-...-2ab7f6d Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Count

func Count(metric string)

Count parses a string into a count for logging to librato

func CountMany

func CountMany(metric string, count int64)

CountMany parses a string and number into a count for logging to librato

func CountWithData

func CountWithData(metric string, count int64, extraData logrus.Fields)

CountWithData parses metrics for logging to librato

func Error

func Error(args ...interface{})

func Fatal

func Fatal(args ...interface{})

func Fatalf

func Fatalf(s string, v ...interface{})

func GetRequestID

func GetRequestID(req *http.Request) string

GetRequestID retrieved the request id, or generates one

func Info

func Info(args ...interface{})

func Infof

func Infof(s string, v ...interface{})

func NewUUID

func NewUUID() (string, error)

NewUUID creates a random UUID

func SMeasure

func SMeasure(subject string, object string) string

func Sample

func Sample(metric string, value int64)

func SampleWithData

func SampleWithData(metric string, value int64, extraData logrus.Fields)

func StringInSlice

func StringInSlice(content []string, check string) bool

StringInSlice checks a string array contains a check value

func TimerEnd

func TimerEnd(startTime time.Time, subject string, extraData logrus.Fields)

func TimerStart

func TimerStart(subject string, extraData logrus.Fields) (time.Time, string, logrus.Fields)

func WithFields

func WithFields(f logrus.Fields) *logrus.Entry

Types

type ResponseLogger

type ResponseLogger struct {
	http.ResponseWriter
	// contains filtered or unexported fields
}

ResponseLogger is a logger for HTTP responses

func NewResponseLogger

func NewResponseLogger(r *http.Request, w http.ResponseWriter) *ResponseLogger

NewResponseLogger creates a new logger for HTTP responses

func (*ResponseLogger) CloseNotify

func (l *ResponseLogger) CloseNotify() <-chan bool

CloseNotify returns a chan notifying when the connection is being closed

func (*ResponseLogger) Flush

func (l *ResponseLogger) Flush()

Flush flushes the response

func (*ResponseLogger) WriteHeader

func (l *ResponseLogger) WriteHeader(s int)

WriteHeader writes a new header to the response

func (*ResponseLogger) WriteLog

func (l *ResponseLogger) WriteLog()

WriteLog logs the response

Jump to

Keyboard shortcuts

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