Skip to content

Latest commit

 

History

History
35 lines (23 loc) · 1.17 KB

README.md

File metadata and controls

35 lines (23 loc) · 1.17 KB

otelzap GoDoc Build Status Coverage Status Go Report Card

OpenTelemetry integration with ZAP logger.

Released under the MIT License.

Quick start

This package can be used to add regular log messages as OpenTelemetry events.

func MyAction(ctx context.Context, foo int) {
    ctx, span := tracer.Start(ctx, "MyAction")
    defer span.End()

    LOG := otelzap.SpanLogger(span, logger)

    LOG.Debug("do my action", zap.Int("foo", foo))
    // will write to stdout as normal zap logger does
    // and also will add "do my action" event to the span
}