Documentation ¶
Index ¶
- func GetSpanID(ctx context.Context) string
- func GetSpanIDFromHeaders(r *http.Request) string
- func GetTraceID(ctx context.Context) string
- func GetTraceIDFromHeaders(r *http.Request) string
- func SetSpanIDAndTraceIDInHeaders(ctx context.Context, r *http.Request)
- func StoreSpanID(ctx context.Context, spanID string) context.Context
- func StoreSpanIDTraceID(ctx context.Context, spanID, traceID string) context.Context
- func StoreTraceID(ctx context.Context, traceID string) context.Context
- type CSLogger
- func (l *CSLogger) Close(ctx context.Context, c io.Closer)
- func (l *CSLogger) Error(ctx context.Context, msg string, args ...interface{})
- func (l *CSLogger) Info(ctx context.Context, msg string, args ...interface{})
- func (l *CSLogger) Invalid(ctx context.Context, subj interface{}, reason string)
- func (l *CSLogger) Query(ctx context.Context, qry string, args ...interface{})
- func (l *CSLogger) Warn(ctx context.Context, msg string, args ...interface{})
- type CtxKey
- type LogJSON
- type LogWriter
- type Logger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetSpanIDFromHeaders ¶
GetSpanIDFromHeaders returns the span ID from the request headers
func GetTraceID ¶
GetTraceID returns the current traceID in the context
func GetTraceIDFromHeaders ¶
GetTraceIDFromHeaders returns the trace ID from the request headers
func SetSpanIDAndTraceIDInHeaders ¶
SetSpanIDAndTraceIDInHeaders sets headers in the request to pass along the span and trace IDs in the context
func StoreSpanID ¶
StoreSpanID returns a context with a stored spanID
func StoreSpanIDTraceID ¶
StoreSpanIDTraceID store both SpanID and TraceID
Types ¶
type CSLogger ¶
type CSLogger struct {
// contains filtered or unexported fields
}
CSLogger controls the format of logs written to the underylying LogWriter
func NewCSLogger ¶
NewCSLogger returns a new CSLogger holding the provided LogWriter
NOTE: uuidGenerator uses a valid a default for the constructor if one is not provided
type LogJSON ¶
type LogJSON struct { Level string `json:"level"` Message string `json:"message"` SpanID string `json:"span_id"` TraceID string `json:"trace_id"` Data map[string]interface{} `json:"data,omitempty"` }
LogJSON is the structure of the JSON logs
type LogWriter ¶
type LogWriter interface {
Println(v ...interface{})
}
LogWriter writes to the concrete type that
type Logger ¶
type Logger interface { // generic logging // Debug(ctx context.Context, msg string, args ...interface{}) Error(ctx context.Context, msg string, args ...interface{}) Info(ctx context.Context, msg string, args ...interface{}) // specific event logging Close(ctx context.Context, c io.Closer) Invalid(ctx context.Context, subj interface{}, reason string) Query(ctx context.Context, qry string, args ...interface{}) }
Logger represents anything that can format logs correctly