Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetLogLevel ¶
func GetLogLevel() string
GetLogLevel returns the current logging level of the library
func SetLogLevel ¶
SetLogLevel changes the logging level of the library Valid logging levels: DEBUG, INFO, WARN, ERROR
func SetLogOutput ¶
SetLogOutput sets the output destination for the internal logger.
func SetTransactionName ¶
SetTransactionName sets the transaction name of the current entry span. If set multiple times, the last is used. Returns nil on success; Error if the provided name is blank, or we are unable to set the transaction name.
Types ¶
type Flusher ¶ added in v1.1.0
func StartLambda ¶ added in v1.1.0
type LogHandler ¶ added in v1.2.0
type LogHandler struct {
// contains filtered or unexported fields
}
LogHandler is a custom slog handler that adds a trace ID from the trace context to each log entry
func NewLogHandler ¶ added in v1.2.0
func NewLogHandler(wrapped slog.Handler) *LogHandler
NewLogHandler creates a new LogHandler
func (*LogHandler) Handle ¶ added in v1.2.0
Handle adds trace context to the record, in the format that allows SWO to associate log lines with traces
type LoggableTraceContext ¶
type LoggableTraceContext struct { TraceID trace.TraceID `json:"trace_id,omitempty"` SpanID trace.SpanID `json:"span_id,omitempty"` TraceFlags trace.TraceFlags `json:"trace_flags,omitempty"` ServiceName string `json:"service_name,omitempty"` }
func LoggableTrace ¶
func LoggableTrace(ctx context.Context) LoggableTraceContext
LoggableTrace returns a LoggableTraceContext from a given context.Context and the configured service name
func LoggableTraceFromSpanContext ¶
func LoggableTraceFromSpanContext(ctx trace.SpanContext) LoggableTraceContext
LoggableTraceFromSpanContext returns a LoggableTraceContext from a given SpanContext and the configured service name
func (LoggableTraceContext) IsValid ¶
func (l LoggableTraceContext) IsValid() bool
IsValid returns true if both TraceID and SpanID are valid
func (LoggableTraceContext) String ¶
func (l LoggableTraceContext) String() string
String returns a string representation that is usable in a log Example: trace_id=d4261c67357f99f39958b14f99da7e6c span_id=1280450002ba77b3 trace_flags=01 resource.service.name=my-service