Search and commands

↑ ↓ to select · Enter to open · Esc to close

Type to search packages.

internal

v1.85.0
google.golang.org/grpc/grpclog/internal

Documentation

pkg.go.dev ↗

Table of contents

↓ to select · Enter to jump· Shift+Enter for source

20 matches

Top ↑

Package internal contains functionality internal to the grpclog package.

Types

DepthLoggerV2

type DepthLoggerV2 interface {
	LoggerV2
	// InfoDepth logs to INFO log at the specified depth. Arguments are handled in the manner of fmt.Println.
	InfoDepth(depth int, args ...any)
	// WarningDepth logs to WARNING log at the specified depth. Arguments are handled in the manner of fmt.Println.
	WarningDepth(depth int, args ...any)
	// ErrorDepth logs to ERROR log at the specified depth. Arguments are handled in the manner of fmt.Println.
	ErrorDepth(depth int, args ...any)
	// FatalDepth logs to FATAL log at the specified depth. Arguments are handled in the manner of fmt.Println.
	FatalDepth(depth int, args ...any)
}

DepthLoggerV2 logs at a specified call frame. If a LoggerV2 also implements DepthLoggerV2, the below functions will be called with the appropriate stack depth set for trivial functions the logger may ignore.

Experimental

Notice: This type is EXPERIMENTAL and may be changed or removed in a later release.

DepthLoggerV2Impl

var DepthLoggerV2Impl DepthLoggerV2

DepthLoggerV2Impl is the logger used for the depth log functions.

Logger

type Logger interface {
	Fatal(args ...any)
	Fatalf(format string, args ...any)
	Fatalln(args ...any)
	Print(args ...any)
	Printf(format string, args ...any)
	Println(args ...any)
}

Logger mimics golang's standard Logger as an interface.

Deprecated: use LoggerV2.

LoggerV2

type LoggerV2 interface {
	// Info logs to INFO log. Arguments are handled in the manner of fmt.Print.
	Info(args ...any)
	// Infoln logs to INFO log. Arguments are handled in the manner of fmt.Println.
	Infoln(args ...any)
	// Infof logs to INFO log. Arguments are handled in the manner of fmt.Printf.
	Infof(format string, args ...any)
	// Warning logs to WARNING log. Arguments are handled in the manner of fmt.Print.
	Warning(args ...any)
	// Warningln logs to WARNING log. Arguments are handled in the manner of fmt.Println.
	Warningln(args ...any)
	// Warningf logs to WARNING log. Arguments are handled in the manner of fmt.Printf.
	Warningf(format string, args ...any)
	// Error logs to ERROR log. Arguments are handled in the manner of fmt.Print.
	Error(args ...any)
	// Errorln logs to ERROR log. Arguments are handled in the manner of fmt.Println.
	Errorln(args ...any)
	// Errorf logs to ERROR log. Arguments are handled in the manner of fmt.Printf.
	Errorf(format string, args ...any)
	// Fatal logs to ERROR log. Arguments are handled in the manner of fmt.Print.
	// gRPC ensures that all Fatal logs will exit with os.Exit(1).
	// Implementations may also call os.Exit() with a non-zero exit code.
	Fatal(args ...any)
	// Fatalln logs to ERROR log. Arguments are handled in the manner of fmt.Println.
	// gRPC ensures that all Fatal logs will exit with os.Exit(1).
	// Implementations may also call os.Exit() with a non-zero exit code.
	Fatalln(args ...any)
	// Fatalf logs to ERROR log. Arguments are handled in the manner of fmt.Printf.
	// gRPC ensures that all Fatal logs will exit with os.Exit(1).
	// Implementations may also call os.Exit() with a non-zero exit code.
	Fatalf(format string, args ...any)
	// V reports whether verbosity level l is at least the requested verbose level.
	V(l int) bool
}

LoggerV2 does underlying logging work for grpclog.

LoggerV2Impl

var LoggerV2Impl LoggerV2

LoggerV2Impl is the logger used for the non-depth log functions.

NewLoggerV2

func NewLoggerV2(infoW, warningW, errorW io.Writer, c LoggerV2Config) LoggerV2

NewLoggerV2 creates a new LoggerV2 instance with the provided configuration. The infoW, warningW, and errorW writers are used to write log messages of different severity levels.

LoggerV2Config

type LoggerV2Config struct {
	// Verbosity sets the verbosity level of the logger.
	Verbosity int
	// FormatJSON controls whether the logger should output logs in JSON format.
	FormatJSON bool
}

LoggerV2Config configures the LoggerV2 implementation.

LoggerWrapper

type LoggerWrapper struct {
	Logger
}

LoggerWrapper wraps Logger into a LoggerV2.

LoggerWrapper.Error

func (l *LoggerWrapper) Error(args ...any)

Error logs to ERROR log. Arguments are handled in the manner of fmt.Print.

LoggerWrapper.Errorf

func (l *LoggerWrapper) Errorf(format string, args ...any)

Errorf logs to ERROR log. Arguments are handled in the manner of fmt.Printf.

LoggerWrapper.Errorln

func (l *LoggerWrapper) Errorln(args ...any)

Errorln logs to ERROR log. Arguments are handled in the manner of fmt.Println.

LoggerWrapper.Info

func (l *LoggerWrapper) Info(args ...any)

Info logs to INFO log. Arguments are handled in the manner of fmt.Print.

LoggerWrapper.Infof

func (l *LoggerWrapper) Infof(format string, args ...any)

Infof logs to INFO log. Arguments are handled in the manner of fmt.Printf.

LoggerWrapper.Infoln

func (l *LoggerWrapper) Infoln(args ...any)

Infoln logs to INFO log. Arguments are handled in the manner of fmt.Println.

LoggerWrapper.V

func (*LoggerWrapper) V(int) bool

V reports whether verbosity level l is at least the requested verbose level.

LoggerWrapper.Warning

func (l *LoggerWrapper) Warning(args ...any)

Warning logs to WARNING log. Arguments are handled in the manner of fmt.Print.

LoggerWrapper.Warningf

func (l *LoggerWrapper) Warningf(format string, args ...any)

Warningf logs to WARNING log. Arguments are handled in the manner of fmt.Printf.

LoggerWrapper.Warningln

func (l *LoggerWrapper) Warningln(args ...any)

Warningln logs to WARNING log. Arguments are handled in the manner of fmt.Println.

Dependency graph