Skip to content

0x2b3bfa0/logrusctx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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")
}

About

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

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages