messages

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2019 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package messages collects logging messages for Sous.

This means that they can all be found in one place. It also simplifies automatic reporting of the sources of messages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReportClientHTTPRequest

func ReportClientHTTPRequest(logger logging.LogSink, message string, rq *http.Request, resName string)

ReportClientHTTPRequest reports a response recieved by Sous as a client. n.b. this interface subject to change

func ReportClientHTTPResponse

func ReportClientHTTPResponse(logger logging.LogSink, message string, rz *http.Response, resName string, dur time.Duration)

ReportClientHTTPResponse reports a response recieved by Sous as a client.

func ReportLogFieldsMessage

func ReportLogFieldsMessage(msg string, loglvl logging.Level, logSink logging.LogSink, items ...interface{})

ReportLogFieldsMessage generate a logFieldsMessage log entry

func ReportLogFieldsMessageToConsole

func ReportLogFieldsMessageToConsole(msg string, loglvl logging.Level, logSink logging.LogSink, items ...interface{})

ReportLogFieldsMessageToConsole report message to console

func ReportLogFieldsMessageWithIDs

func ReportLogFieldsMessageWithIDs(msg string, loglvl logging.Level, logSink logging.LogSink, items ...interface{})

ReportLogFieldsMessageWithIDs report message with Ids

func ReportServerHTTPRequest

func ReportServerHTTPRequest(logger logging.LogSink, message string, rq *http.Request, resName string)

ReportServerHTTPRequest reports a response recieved by Sous as a client. n.b. this interface subject to change

func ReportServerHTTPResponding

func ReportServerHTTPResponding(logger logging.LogSink, message string, req *http.Request, status int, responseContentLength int64, resName string, dur time.Duration)

ReportServerHTTPResponding reports a response to a request - this is useful in cases where a ResponseWriter is encapsulating the actual response.

func ReportServerHTTPResponse

func ReportServerHTTPResponse(logger logging.LogSink, message string, rz *http.Response, resName string, dur time.Duration)

ReportServerHTTPResponse reports a response recieved by Sous as a client.

Types

type HTTPLogEntry

type HTTPLogEntry struct {
	logging.CallerInfo
	logging.Level
	// contains filtered or unexported fields
}

HTTPLogEntry struct to hold log entry messages

func (*HTTPLogEntry) EachField

func (msg *HTTPLogEntry) EachField(f logging.FieldReportFn)

EachField to populate the proper fields from message

func (*HTTPLogEntry) EachFieldWithoutCallerInfo

func (msg *HTTPLogEntry) EachFieldWithoutCallerInfo(f logging.FieldReportFn)

EachFieldWithoutCallerInfo allows sub messages to populate logging.FieldReportFn without out having to call CallerInfo

func (*HTTPLogEntry) Message

func (msg *HTTPLogEntry) Message() string

Message retrieve message from log message

func (*HTTPLogEntry) MetricsTo

func (msg *HTTPLogEntry) MetricsTo(metrics logging.MetricsSink)

MetricsTo function to send metrics to graphite

func (*HTTPLogEntry) Status

func (msg *HTTPLogEntry) Status() int

Status method to retrieve status from message

Jump to

Keyboard shortcuts

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