zap

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2021 License: Apache-2.0 Imports: 5 Imported by: 1

README

zap

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

Usage

import (
    "fmt"
    "sync/mutex"
    "time"

    "go.uber.org/zap"

    "github.com/ydb-platform/ydb-go-sdk/v3"

    ydbZap "github.com/ydb-platform/ydb-go-sdk-zap"
)

func main() {
	// init your zap.Logger
	log, err := zap.NewProduction()
	
    db, err := ydb.New(
        context.Background(),
		ydb.MustConnectionString(connection),
		ydb.WithTraceDriver(ydbZap.Driver(
			log,
			ydbZap.DetailsAll,
		)),
		ydb.WithTraceTable(ydbZap.Table(
			log,
			ydbZap.DetailsAll,
		)),
	)
    // work with db
}

Documentation

Index

Constants

View Source
const (
	DriverClusterEvents = Details(1 << iota)

	DriverCoreEvents
	DriverCredentialsEvents
	DriverDiscoveryEvents

	DriverConnEvents = driverNetEvents | DriverCoreEvents

	TableSessionEvents = tableSessionEvents | tableSessionQueryEvents | tableSessionTransactionEvents
	TablePoolEvents    = tablePoolLifeCycleEvents | tablePoolRetryEvents | tablePoolSessionLifeCycleEvents | tablePoolAPIEvents
	DetailsAll         = ^Details(0)
)

Variables

This section is empty.

Functions

func Driver

func Driver(log *zap.Logger, details Details) trace.Driver

Driver makes trace.Driver with zap logging

func Table

func Table(log *zap.Logger, details Details) trace.Table

Table makes trace.Table with zap logging

Types

type Details

type Details int

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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