internal

package
v1.66.0 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package internal contains functionality internal to the grpclog package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type 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.

var DepthLoggerV2Impl DepthLoggerV2

DepthLoggerV2Impl is the logger used for the depth log functions.

type Logger deprecated

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.

type 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.

var LoggerV2Impl LoggerV2

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

func 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.

type 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.

type LoggerWrapper

type LoggerWrapper struct {
	Logger
}

LoggerWrapper wraps Logger into a LoggerV2.

func (*LoggerWrapper) Error

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

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

func (*LoggerWrapper) Errorf

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

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

func (*LoggerWrapper) Errorln

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

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

func (*LoggerWrapper) Info

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

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

func (*LoggerWrapper) Infof

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

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

func (*LoggerWrapper) Infoln

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

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

func (*LoggerWrapper) V

func (*LoggerWrapper) V(l int) bool

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

func (*LoggerWrapper) Warning

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

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

func (*LoggerWrapper) Warningf

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

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

func (*LoggerWrapper) Warningln

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

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

Jump to

Keyboard shortcuts

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