logrus

command module
v0.0.0-...-316a413 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2021 License: BSD-2-Clause Imports: 7 Imported by: 0

README

Logrus OpenTelemetry instrumentation example

PkgGoDev

Quickstart

To install otellogrus instrumentation:

go get github.com/uptrace/uptrace-go/extra/otellogrus

Then add OpenTelemetry hook:

logrus.AddHook(otellogrus.NewHook())

And use WithContext to propagate the active span:

logrus.WithContext(ctx).
    WithError(errors.New("hello world")).
    WithField("foo", "bar").
    Error("hello from logrus")

Example

To run this example:

UPTRACE_DSN="https://<token>@api.uptrace.dev/<project_id>" go run .

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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