logging

package
v1.7.0-beta Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: Apache-2.0 Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGRPCInternalLogger

func NewGRPCInternalLogger(logger *zap.Logger) grpclog.LoggerV2

NewGRPCInternalLogger creates a new grpclog.LoggerV2 that wraps the given zap logger.

func NewGRPCLogger

func NewGRPCLogger(grpcSyncer *BufferedGrpcWriteSyncer, addCaller bool, clock zapcore.Clock) *zap.Logger

NewGRPCLogger creates a Zap logger with multiple writesyncs: one to stdout and one for GRPC writestream.

func NewProductionGRPCLogger

func NewProductionGRPCLogger(grpcSyncer *BufferedGrpcWriteSyncer) *zap.Logger

NewProductionGRPCLogger creates a Zap logger configured for production.

func SetupGRPCInternalLogging

func SetupGRPCInternalLogging(logger *zap.Logger)

SetupGRPCInternalLogging configures GRPC to use the provided zap logger for all internal logging. This should be called early in main().

Types

type BufferedGrpcWriteSyncer

type BufferedGrpcWriteSyncer struct {
	// contains filtered or unexported fields
}

BufferedGrpcWriteSyncer is a custom zap writesync that writes to a grpc stream In case stream is not connected it will buffer to memory.

func NewBufferedGrpcWriteSyncer

func NewBufferedGrpcWriteSyncer() *BufferedGrpcWriteSyncer

NewBufferedGrpcWriteSyncer returns a new BufferedGrpcWriteSyncer.

func NewBufferedGrpcWriteSyncerForTest

func NewBufferedGrpcWriteSyncerForTest(logger *zap.Logger) *BufferedGrpcWriteSyncer

NewBufferedGrpcWriteSyncerForTest creates a BufferedGrpcWriteSyncer for testing with a logger.

func (*BufferedGrpcWriteSyncer) Close

func (b *BufferedGrpcWriteSyncer) Close() error

Close flushes buffered log data into grpc stream if possible, and closes the connection.

func (*BufferedGrpcWriteSyncer) GetLogLevel

func (b *BufferedGrpcWriteSyncer) GetLogLevel() zapcore.Level

GetLogLevel returns the current log level (for testing).

func (*BufferedGrpcWriteSyncer) SetDone

func (b *BufferedGrpcWriteSyncer) SetDone(done chan struct{})

SetDone sets the done channel for the BufferedGrpcWriteSyncer.

func (*BufferedGrpcWriteSyncer) UpdateClient

func (b *BufferedGrpcWriteSyncer) UpdateClient(client LogStream, conn ClientConnInterface)

UpdateClient updates the gRPC connection and connection in the BufferedGrpcWriteSyncer.

func (*BufferedGrpcWriteSyncer) UpdateLogLevel

func (b *BufferedGrpcWriteSyncer) UpdateLogLevel(level pb.LogLevel)

UpdateLogLevel sets the logger's log level based on the response from the server.

type ClientConnInterface

type ClientConnInterface interface {
	GetState() connectivity.State
	Close() error
}

ClientConnInterface abstracts gRPC connection state checking.

type LogStream

type LogStream interface {
	Send(req *pb.SendLogsRequest) error
	Recv() (*pb.SendLogsResponse, error)
	CloseSend() error
}

LogStream abstracts the SendLogs gRPC stream.

Jump to

Keyboard shortcuts

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