Documentation ¶
Index ¶
- func Annotator(ctx context.Context, req *http.Request) metadata.MD
- func CopyLoggerWithLevel(logger *logrus.Logger, lvl logrus.Level) *logrus.Logger
- func DisableRequestID(o *gwLogCfg)
- func EnableAccountID(o *gwLogCfg)
- func EnableDynamicLogLevel(o *gwLogCfg)
- func GatewayLoggingInterceptor(logger *logrus.Logger, opts ...GWLogOption) grpc.UnaryClientInterceptor
- func GatewayLoggingSentinelInterceptor() grpc.UnaryClientInterceptor
- func LogLevelInterceptor(defaultLevel logrus.Level) grpc.UnaryServerInterceptor
- func SentinelValueFromCtx(ctx context.Context) (value, ok bool)
- type GWLogOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Annotator ¶
Annotator is a function that reads the http headers of incoming requests searching for special logging arguments
func CopyLoggerWithLevel ¶
CopyLoggerWithLevel makes a copy of the given (logrus) logger at the logger level. If copying an entry, use CopyLoggerWithLevel(entry.Logger, level).WithFields(entry.Data) on the result (changes to these entries' fields will not affect each other).
func DisableRequestID ¶ added in v0.16.2
func DisableRequestID(o *gwLogCfg)
DisableRequestID disables request-id inclusion (and generation if needed) in gw interceptor logs
func EnableAccountID ¶ added in v0.16.2
func EnableAccountID(o *gwLogCfg)
EnableAccountID is a shorthand for WithAccountID(nil)
func EnableDynamicLogLevel ¶ added in v0.16.2
func EnableDynamicLogLevel(o *gwLogCfg)
EnableDynamicLogLevel is a shorthand for WithDynamicLogLevel(true)
func GatewayLoggingInterceptor ¶ added in v0.16.2
func GatewayLoggingInterceptor(logger *logrus.Logger, opts ...GWLogOption) grpc.UnaryClientInterceptor
GatewayLoggingInterceptor handles the functions of the various toolkit interceptors offered for the grpc server, as well as the standard grpc_logrus server interceptor behavior (superset of grpc_logrus client interceptor behavior)
func GatewayLoggingSentinelInterceptor ¶ added in v0.16.2
func GatewayLoggingSentinelInterceptor() grpc.UnaryClientInterceptor
GatewayLoggingSentinelInterceptor is meant to be the last interceptor in the client interceptor chain, it sets a value left in the context by the GatewayLoggingInterceptor so that it knows whether the call makes it to the server, and thus the server will log the call, and the gateway doesn't need to.
func LogLevelInterceptor ¶
func LogLevelInterceptor(defaultLevel logrus.Level) grpc.UnaryServerInterceptor
LogLevelInterceptor sets the level of the logger in the context to either the default or the value set in the context via grpc metadata. Also sets the custom log tag if present for pseudo-tracing purposes
func SentinelValueFromCtx ¶ added in v0.17.0
Types ¶
type GWLogOption ¶ added in v0.16.2
type GWLogOption func(*gwLogCfg)
GWLogOption is a type of function that alters a gwLogCfg in the instantiation of a GatewayLoggingInterceptor
func WithAccountID ¶ added in v0.16.2
func WithAccountID(keyfunc jwt.Keyfunc) GWLogOption
WithAccountID enables the account_id field in gw interceptor logs, like the server interceptor
func WithCodeFunc ¶ added in v0.17.0
func WithCodeFunc(codeFunc grpc_logrus.CodeToLevel) GWLogOption
func WithDynamicLogLevel ¶ added in v0.16.2
func WithDynamicLogLevel(enable bool) GWLogOption
WithDynamicLogLevel enables or disables dynamic log levels like handled in the server interceptor