Skip to content

Latest commit

 

History

History
34 lines (24 loc) · 919 Bytes

README.md

File metadata and controls

34 lines (24 loc) · 919 Bytes

logrusctx reference tests

Port of github.com/juju/zaputil/zapctx for github.com/sirupsen/logrus

Example

package main

import (
	"context"

	"github.com/sirupsen/logrus"
	"github.com/0x2b3bfa0/logrusctx"
)

func main() {
	ctx := context.Background()
	logger := logrus.WithField("key", "value")

	ctx = logrusctx.WithLogger(ctx, logger)
	worker(ctx)
}

func worker(ctx context.Context) {
	logrusctx.Info(ctx, "test")
}