monitor

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Logger = log.New()

Functions

func LogFailedQuery

func LogFailedQuery(method string, query interface{}, error interface{})

LogFailedQuery takes a method name, query params, response error object and logs it

func LogSuccessfulQuery

func LogSuccessfulQuery(method string, time float64)

LogSuccessfulQuery takes a remote method name and execution time and logs it

func RequestLoggingMiddleware

func RequestLoggingMiddleware(next http.Handler) http.Handler

Types

type LoggingWriter

type LoggingWriter struct {
	http.ResponseWriter
	Status          int
	ResponseSnippet string
	ResponseSize    int
}

LoggingWriter mimics http.ResponseWriter but stores a snippet of response, status code and response size for easier logging

func (*LoggingWriter) IsSuccess

func (w *LoggingWriter) IsSuccess() bool

func (*LoggingWriter) Write

func (w *LoggingWriter) Write(p []byte) (int, error)

func (*LoggingWriter) WriteHeader

func (w *LoggingWriter) WriteHeader(status int)

Jump to

Keyboard shortcuts

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