grpclogger

package
v0.0.0-...-ca3fe5b Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2016 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package grpclogger creates a logger interface to be used in grpc logger package (google.golang.org/grpc/grpclog). For more information on grpc see http://www.grpc.io, for grpc-go see https://github.com/grpc/grpc-go.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateLogger

func CreateLogger(tags logger.Tags, closeFn func()) grpclog.Logger

CreateLogger creates a new logger that can be used in grpc/grpclog. It follows the default log package style of logging and therefore it doesn't have log levels (EventType). Because of this all calls to Print* will call logger.Error, hoping that grpclogger will only log errors in production.

Another shortcoming of the Logger interface defined by grpclog is that uses an empty interface a lot. We combat this by trying to make this into a single string using the fmt package. As result of this the message might not look very pretty, but it will contain all the provided information.

A third point is that a call to Fatal* in the builtin log package calls to os.Exit, which closes the application immediately without running deffered statements. To combat that we accept a close function which runs before the call to os.Exit. In this function logger.Close must be called by the user.

Types

This section is empty.

Jump to

Keyboard shortcuts

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