logur: logur.dev/logur/integration/grpc Index | Files

package grpc

import "logur.dev/logur/integration/grpc"

Package grpc provides a V2 gRPC logger.

gRPC operates with a globally configured logger that implements the google.golang.org/grpc/grpclog.LoggerV2 interface.

With logur you can easily wire the logging library of your choice into gRPC:

package main

import (
	"logur.dev/logur"
	grpcintegration "logur.dev/logur/integration/grpc"
	"google.golang.org/grpc/grpclog"
)

func main() {
	logger := logur.NewNoopLogger() // choose an actual implementation
	grpclog.SetLoggerV2(grpcintegration.New(logger))
}

Index

Package Files

logger.go

type Logger Uses

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

Logger is a V2 gRPC logger.

func New Uses

func New(logger logur.Logger) *Logger

New returns a new V2 gRPC logger.

func (*Logger) Error Uses

func (l *Logger) Error(args ...interface{})

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

func (*Logger) Errorf Uses

func (l *Logger) Errorf(format string, args ...interface{})

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

func (*Logger) Errorln Uses

func (l *Logger) Errorln(args ...interface{})

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

func (*Logger) Fatal Uses

func (l *Logger) Fatal(args ...interface{})

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.

func (*Logger) Fatalf Uses

func (l *Logger) Fatalf(format string, args ...interface{})

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.

func (*Logger) Fatalln Uses

func (l *Logger) Fatalln(args ...interface{})

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.

func (*Logger) Info Uses

func (l *Logger) Info(args ...interface{})

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

func (*Logger) Infof Uses

func (l *Logger) Infof(format string, args ...interface{})

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

func (*Logger) Infoln Uses

func (l *Logger) Infoln(args ...interface{})

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

func (*Logger) V Uses

func (l *Logger) V(level int) bool

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

func (*Logger) Warning Uses

func (l *Logger) Warning(args ...interface{})

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

func (*Logger) Warningf Uses

func (l *Logger) Warningf(format string, args ...interface{})

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

func (*Logger) Warningln Uses

func (l *Logger) Warningln(args ...interface{})

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

Package grpc imports 3 packages (graph). Updated 2020-01-24. Refresh now. Tools for package owners.