Documentation ¶
Index ¶
- Constants
- type SpanLogger
- func FromContext(ctx context.Context) *SpanLogger
- func FromContextWithFallback(ctx context.Context, fallback log.Logger) *SpanLogger
- func New(ctx context.Context, method string, kvps ...interface{}) (*SpanLogger, context.Context)
- func NewWithLogger(ctx context.Context, logger log.Logger, method string, kvps ...interface{}) (*SpanLogger, context.Context)
Constants ¶
const ( // TenantIDsTagName is the tenant IDs tag name. TenantIDsTagName = spanlogger.TenantIDsTagName )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SpanLogger ¶
type SpanLogger = spanlogger.SpanLogger
SpanLogger unifies tracing and logging, to reduce repetition.
func FromContext ¶
func FromContext(ctx context.Context) *SpanLogger
FromContext returns a SpanLogger using the current parent span. If there is no parent span, the SpanLogger will only log to the logger within the context. If the context doesn't have a logger, the fallback logger is used.
func FromContextWithFallback ¶
func FromContextWithFallback(ctx context.Context, fallback log.Logger) *SpanLogger
FromContextWithFallback returns a span logger using the current parent span. IF there is no parent span, the SpanLogger will only log to the logger within the context. If the context doesn't have a logger, the fallback logger is used.
func New ¶
New makes a new SpanLogger with a log.Logger to send logs to. The provided context will have the logger attached to it and can be retrieved with FromContext.
func NewWithLogger ¶
func NewWithLogger(ctx context.Context, logger log.Logger, method string, kvps ...interface{}) (*SpanLogger, context.Context)
NewWithLogger is like New but allows to pass a logger.