package grpclog
import "google.golang.org/grpc/internal/grpclog"
Package grpclog (internal) defines depth logging for grpc.
Index ¶
- func ErrorDepth(depth int, args ...any)
- func FatalDepth(depth int, args ...any)
- func InfoDepth(depth int, args ...any)
- func WarningDepth(depth int, args ...any)
- type DepthLoggerV2
- type LoggerV2
- type PrefixLogger
- func NewPrefixLogger(logger DepthLoggerV2, prefix string) *PrefixLogger
- func (pl *PrefixLogger) Debugf(format string, args ...any)
- func (pl *PrefixLogger) Errorf(format string, args ...any)
- func (pl *PrefixLogger) Infof(format string, args ...any)
- func (pl *PrefixLogger) V(l int) bool
- func (pl *PrefixLogger) Warningf(format string, args ...any)
Functions ¶
func ErrorDepth ¶
ErrorDepth logs to the ERROR log at the specified depth.
func FatalDepth ¶
FatalDepth logs to the FATAL log at the specified depth.
func InfoDepth ¶
InfoDepth logs to the INFO log at the specified depth.
func WarningDepth ¶
WarningDepth logs to the WARNING log at the specified depth.
Types ¶
type DepthLoggerV2 ¶
type DepthLoggerV2 interface { // 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. This is a copy of the DepthLoggerV2 defined in the external grpclog package. It is defined here to avoid a circular dependency.
Experimental
Notice: This type is EXPERIMENTAL and may be changed or removed in a later release.
var DepthLogger DepthLoggerV2
DepthLogger is the logger used for the depth log functions.
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. This is a copy of the LoggerV2 defined in the external grpclog package. It is defined here to avoid a circular dependency.
var Logger LoggerV2
Logger is the logger used for the non-depth log functions.
type PrefixLogger ¶
type PrefixLogger struct {
// contains filtered or unexported fields
}
PrefixLogger does logging with a prefix.
Logging method on a nil logs without any prefix.
func NewPrefixLogger ¶
func NewPrefixLogger(logger DepthLoggerV2, prefix string) *PrefixLogger
NewPrefixLogger creates a prefix logger with the given prefix.
func (*PrefixLogger) Debugf ¶
func (pl *PrefixLogger) Debugf(format string, args ...any)
Debugf does info logging at verbose level 2.
func (*PrefixLogger) Errorf ¶
func (pl *PrefixLogger) Errorf(format string, args ...any)
Errorf does error logging.
func (*PrefixLogger) Infof ¶
func (pl *PrefixLogger) Infof(format string, args ...any)
Infof does info logging.
func (*PrefixLogger) V ¶
func (pl *PrefixLogger) V(l int) bool
V reports whether verbosity level l is at least the requested verbose level.
func (*PrefixLogger) Warningf ¶
func (pl *PrefixLogger) Warningf(format string, args ...any)
Warningf does warning logging.
Source Files ¶
grpclog.go prefixLogger.go
- Version
- v1.60.0
- Published
- Dec 11, 2023
- Platform
- linux/amd64
- Imports
- 2 packages
- Last checked
- 2 hours ago –
Tools for package owners.