log

package
v0.0.0-...-03689f6 Latest Latest
Warning

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

Go to latest
Published: May 22, 2019 License: MIT Imports: 13 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Event = event

Event records an event

View Source
var HumanReadable bool

HumanReadable represents a flag to determine if log events will be in a human readable format

View Source
var Namespace = "service-namespace"

Namespace is the service namespace used for logging

Functions

func Debug

func Debug(message string, data Data)

Debug is a structured trace message

func DebugC

func DebugC(correlationKey string, message string, data Data)

DebugC is a structured debug message with correlationKey

func DebugCtx

func DebugCtx(ctx context.Context, message string, data Data)

DebugCtx is a structured debug message and retrieves the correlationKey from go context

func DebugR

func DebugR(req *http.Request, message string, data Data)

DebugR is a structured debug message for a request

func Error

func Error(err error, data Data)

Error is a structured error message

func ErrorC

func ErrorC(correlationKey string, err error, data Data)

ErrorC is a structured error message with correlationKey

func ErrorCtx

func ErrorCtx(ctx context.Context, err error, data Data)

ErrorCtx is a structured error message and retrieves the correlationKey from go context

func ErrorR

func ErrorR(req *http.Request, err error, data Data)

ErrorR is a structured error message for a request

func GetRequestID

func GetRequestID(req *http.Request) string

GetRequestID returns the request ID from a request (using X-Request-Id)

func Handler

func Handler(h http.Handler) http.Handler

Handler wraps a http.Handler and logs the status code and total response time

func Info

func Info(message string, data Data)

Info is a structured info message

func InfoC

func InfoC(correlationKey string, message string, data Data)

InfoC is a structured info message with correlationKey

func InfoCtx

func InfoCtx(ctx context.Context, message string, data Data)

InfoCtx is a structured info message and retrieves the correlationKey from go context

func InfoR

func InfoR(req *http.Request, message string, data Data)

InfoR is a structured info message for a request

func Trace

func Trace(message string, data Data)

Trace is a structured trace message

func TraceC

func TraceC(correlationKey string, message string, data Data)

TraceC is a structured trace message with correlationKey

func TraceCtx

func TraceCtx(ctx context.Context, message string, data Data)

TraceCtx is a structured trace message and retrieves the correlationKey from go context

func TraceR

func TraceR(req *http.Request, message string, data Data)

TraceR is a structured trace message for a request

Types

type Data

type Data map[string]interface{}

Data contains structured log data

Jump to

Keyboard shortcuts

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