logging

package
v0.74.0 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package logging provides a logger that logs fx events.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultFxLoggingOption added in v0.60.0

func DefaultFxLoggingOption() fx.Option

DefaultFxLoggingOption creates an fx.Option to configure the Fx logger, either to do nothing (the default) or to log to the console (when TRACE_FX is set at `1`).

func EnableFxLoggingOnDebug added in v0.60.0

func EnableFxLoggingOnDebug[T Logger]() fx.Option

EnableFxLoggingOnDebug enables the logs for FX events when log_level is debug. This function requires that DefaultFxLoggingOption is part of the fx Options. This function uses generics to avoid depending on the logger component. When TRACE_FX is set to 0, it will disable the logging.

Types

type FxTracingLogger added in v0.74.0

type FxTracingLogger struct {
	// contains filtered or unexported fields
}

FxTracingLogger implements fxevent.Logger interface to capture Fx lifecycle events and send them as traces to Datadog.

func (*FxTracingLogger) EnableSpansSending added in v0.74.0

func (l *FxTracingLogger) EnableSpansSending(traceAgentPort string)

EnableSpansSending will allow the tracer to forward traces to the trace-agent when the Fx initialization is complete.

func (*FxTracingLogger) LogEvent added in v0.74.0

func (l *FxTracingLogger) LogEvent(event fxevent.Event)

LogEvent implements the fxevent.Logger interface.

func (*FxTracingLogger) UpdateInnerLoggers added in v0.74.0

func (l *FxTracingLogger) UpdateInnerLoggers(logger fxevent.Logger, agentLogger io.Writer)

UpdateInnerLoggers updates the inner loggers of the FxTracingLogger.

type Logger

type Logger interface {
	Debug(v ...interface{})
}

Logger is a logger that logs fx events.

type Span added in v0.74.0

type Span struct {
	Service  string `json:"service"`
	Name     string `json:"name"`
	Resource string `json:"resource"`
	TraceID  uint64 `json:"trace_id"`
	SpanID   uint64 `json:"span_id"`
	ParentID uint64 `json:"parent_id"`
	Start    int64  `json:"start"`
	Duration int64  `json:"duration"`
	Error    int32  `json:"error"`
	// Meta     map[string]string  `json:"meta,omitempty"`
	// Metrics  map[string]float64 `json:"metrics,omitempty"`
	Type string `json:"type,omitempty"`
}

Span represents a Datadog APM span in JSON format for the v0.3/traces endpoint. This structure is based on the Span proto message in the datadog/trace package. https://github.com/DataDog/datadog-agent/blob/5be2876e3fc36fb1b70c69304bf6876ec90ed016/pkg/proto/pbgo/trace/span.pb.go#L519-L569

Jump to

Keyboard shortcuts

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