package grpclog
import "google.golang.org/grpc/grpclog"
Package grpclog defines logging for grpc.
In the default logger, severity level can be set by environment variable GRPC_GO_LOG_SEVERITY_LEVEL, verbosity level can be set by GRPC_GO_LOG_VERBOSITY_LEVEL.
Index ¶
- func Error(args ...any)
- func ErrorDepth(depth int, args ...any)
- func Errorf(format string, args ...any)
- func Errorln(args ...any)
- func Fatal(args ...any)
- func FatalDepth(depth int, args ...any)
- func Fatalf(format string, args ...any)
- func Fatalln(args ...any)
- func Info(args ...any)
- func InfoDepth(depth int, args ...any)
- func Infof(format string, args ...any)
- func Infoln(args ...any)
- func Print(args ...any)
- func Printf(format string, args ...any)
- func Println(args ...any)
- func SetLogger(l Logger)
- func SetLoggerV2(l LoggerV2)
- func V(l int) bool
- func Warning(args ...any)
- func WarningDepth(depth int, args ...any)
- func Warningf(format string, args ...any)
- func Warningln(args ...any)
- type DepthLoggerV2
- type Logger
- type LoggerV2
Functions ¶
func Error ¶
func Error(args ...any)
Error logs to the ERROR log.
func ErrorDepth ¶
ErrorDepth logs to the ERROR log at the specified depth.
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
func Errorf ¶
Errorf logs to the ERROR log. Arguments are handled in the manner of fmt.Printf.
func Errorln ¶
func Errorln(args ...any)
Errorln logs to the ERROR log. Arguments are handled in the manner of fmt.Println.
func Fatal ¶
func Fatal(args ...any)
Fatal logs to the FATAL log. Arguments are handled in the manner of fmt.Print. It calls os.Exit() with exit code 1.
func FatalDepth ¶
FatalDepth logs to the FATAL log at the specified depth.
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
func Fatalf ¶
Fatalf logs to the FATAL log. Arguments are handled in the manner of fmt.Printf. It calls os.Exit() with exit code 1.
func Fatalln ¶
func Fatalln(args ...any)
Fatalln logs to the FATAL log. Arguments are handled in the manner of fmt.Println. It calls os.Exit() with exit code 1.
func Info ¶
func Info(args ...any)
Info logs to the INFO log.
func InfoDepth ¶
InfoDepth logs to the INFO log at the specified depth.
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
func Infof ¶
Infof logs to the INFO log. Arguments are handled in the manner of fmt.Printf.
func Infoln ¶
func Infoln(args ...any)
Infoln logs to the INFO log. Arguments are handled in the manner of fmt.Println.
func Print ¶
func Print(args ...any)
Print prints to the logger. Arguments are handled in the manner of fmt.Print.
Deprecated: use Info.
func Printf ¶
Printf prints to the logger. Arguments are handled in the manner of fmt.Printf.
Deprecated: use Infof.
func Println ¶
func Println(args ...any)
Println prints to the logger. Arguments are handled in the manner of fmt.Println.
Deprecated: use Infoln.
func SetLogger ¶
func SetLogger(l Logger)
SetLogger sets the logger that is used in grpc. Call only from init() functions.
Deprecated: use SetLoggerV2.
func SetLoggerV2 ¶
func SetLoggerV2(l LoggerV2)
SetLoggerV2 sets logger that is used in grpc to a V2 logger. Not mutex-protected, should be called before any gRPC functions.
func V ¶
V reports whether verbosity level l is at least the requested verbose level.
func Warning ¶
func Warning(args ...any)
Warning logs to the WARNING log.
func WarningDepth ¶
WarningDepth logs to the WARNING log at the specified depth.
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
func Warningf ¶
Warningf logs to the WARNING log. Arguments are handled in the manner of fmt.Printf.
func Warningln ¶
func Warningln(args ...any)
Warningln logs to the WARNING log. Arguments are handled in the manner of fmt.Println.
Types ¶
type DepthLoggerV2 ¶
type DepthLoggerV2 internal.DepthLoggerV2
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.
func Component ¶
func Component(componentName string) DepthLoggerV2
Component creates a new component and returns it for logging. If a component with the name already exists, nothing will be created and it will be returned. SetLoggerV2 will panic if it is called with a logger created by Component.
type Logger ¶
Logger mimics golang's standard Logger as an interface.
Deprecated: use LoggerV2.
type LoggerV2 ¶
LoggerV2 does underlying logging work for grpclog.
func NewLoggerV2 ¶
NewLoggerV2 creates a loggerV2 with the provided writers. Fatal logs will be written to errorW, warningW, infoW, followed by exit(1). Error logs will be written to errorW, warningW and infoW. Warning logs will be written to warningW and infoW. Info logs will be written to infoW.
func NewLoggerV2WithVerbosity ¶
NewLoggerV2WithVerbosity creates a loggerV2 with the provided writers and verbosity level.
Source Files ¶
component.go grpclog.go logger.go loggerv2.go
Directories ¶
Path | Synopsis |
---|---|
grpclog/glogger | Package glogger defines glog-based logging for grpc. |
grpclog/internal | Package internal contains functionality internal to the grpclog package. |
- Version
- v1.70.0 (latest)
- Published
- Jan 23, 2025
- Platform
- linux/amd64
- Imports
- 6 packages
- Last checked
- 17 hours ago –
Tools for package owners.