requestdump

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: May 2, 2023 License: MIT Imports: 13 Imported by: 0

README

requestdump

requestdump is an interceptor to log request/response messages including header/metadata as json with zap.

Usage

import (
 "github.com/eltorocorp/go-grpc-request-id-interceptor/requestdump"
)

func main() {
 zaplogger := zap.New(zap.NewJSONEncoder())
 uIntOpt := grpc.UnaryInterceptor(requestdump.UnaryServerInterceptor(requestdump.Zap(zaplogger)))
 grpc.NewServer(uIntOpt, sIntOpt)
}
options
  • requestdump.Zap
  • zap logger for requestdump
  • requestdump.RootKey
  • dump message key name
  • requestdump.Disable
  • disable requestdump

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UnaryServerInterceptor

func UnaryServerInterceptor(opt ...Option) grpc.UnaryServerInterceptor

Types

type Option

type Option interface {
	// contains filtered or unexported methods
}

func Disable

func Disable() Option

func RootKey

func RootKey(key string) Option

func Zap

func Zap(logger zap.Logger) Option

Jump to

Keyboard shortcuts

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