colorlog

package module
v0.0.0-...-76f4262 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

README

go-grpc-colorlog

usage

import (
    "google.golang.org/grpc"
    grpc_colorlog "github.com/wei840222/go-grpc-colorlog"
    grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware"
)

myServer := grpc.NewServer(
    grpc.StreamInterceptor(grpc_middleware.ChainStreamServer(
        grpc_colorlog.StreamServerInterceptor(),
    )),
    grpc.UnaryInterceptor(grpc_middleware.ChainUnaryServer(
        grpc_colorlog.UnaryServerInterceptor(),
    )),
)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StreamServerInterceptor

func StreamServerInterceptor(opts ...Option) grpc.StreamServerInterceptor

StreamServerInterceptor returns a new streaming server interceptor.

func UnaryServerInterceptor

func UnaryServerInterceptor(opts ...Option) grpc.UnaryServerInterceptor

UnaryServerInterceptor returns a new unary server interceptors.

Types

type Option

type Option func(*options)

Option function for set options

func WithDecider

func WithDecider(f grpc_logging.Decider) Option

WithDecider customizes the function for deciding if the gRPC interceptor logs should log.

func WithErrorToCode

func WithErrorToCode(f grpc_logging.ErrorToCode) Option

WithErrorToCode customizes the function for mapping errors to error codes.

func WithForceOutputColor

func WithForceOutputColor(b bool) Option

WithForceOutputColor customizes the function for force enable output color.

Jump to

Keyboard shortcuts

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