Categorygithub.com/ydb-platform/ydb-go-sdk-logrus
modulepackage
0.0.1
Repository: https://github.com/ydb-platform/ydb-go-sdk-logrus.git
Documentation: pkg.go.dev

# README

logrus

logrus package helps to create ydb-go-sdk traces with logging driver events with logrus

Usage

import (
	"context"
	"os"

	"github.com/sirupsen/logrus"
	"github.com/ydb-platform/ydb-go-sdk/v3"
	"github.com/ydb-platform/ydb-go-sdk/v3/trace"

	ydbLogrus "github.com/ydb-platform/ydb-go-sdk-logrus"
)

func main() {
	// init your logrus.Logger
	log := logrus.New(os.Stdout).With().Timestamp().Logger()

	db, err := ydb.Open(
		context.Background(),
		os.Getenv("YDB_CONNECTION_STRING"),
		ydbLogrus.WithTraces(
			&log,
			trace.DetailsAll,
		),
	)
	if err != nil {
		panic(err)
	}
	defer func() {
		_ = db.Close(context.Background())
	}()

	// work with db
}

# Functions

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author