logger

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package logger provides a general logging tools

Index

Constants

View Source
const Text = "text"

Text is the constant for the text format

Variables

This section is empty.

Functions

func FromFlags

func FromFlags(cfg config.LoggingConfig) zerolog.Logger

FromFlags configures logging and returns a logger with settings matching the supplied cfg. It also performs some global initialization, because that's how zerolog works.

func Interceptor

func Interceptor() grpc.UnaryServerInterceptor

Interceptor creates a gRPC unary server interceptor that logs incoming requests and their responses using the Zerolog logger attached to the context.Context. Successful requests are logged at the info level and error requests are logged at the error level.

Returns:

  • grpc.UnaryServerInterceptor: The gRPC unary server interceptor function.

Example usage:

server := grpc.NewServer(
  ...
  grpc.UnaryInterceptor(logger.Interceptior),
  ...
)

Types

This section is empty.

Jump to

Keyboard shortcuts

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