ctxt

package
v0.0.0-...-7e06a17 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLogger

func GetLogger(ctx context.Context) *zerolog.Logger

GetLogger returns the zerolog logger from context. It returns nil if not available.

func InitApplicationContext

func InitApplicationContext(ctx context.Context) context.Context

InitApplicationContext returns a new context with a new ApplicationContext.

func InitLogContext

func InitLogContext(ctx context.Context, log *zerolog.Logger) context.Context

InitLogContext returns a new context with a new LogContext.

func SetLogger

func SetLogger(ctx context.Context, log *zerolog.Logger)

SetLogger updates the logger in log context. Note that if the context is not initialized, the logger is not updated.

Types

type ApplicationContext

type ApplicationContext struct {
	TransactionID string
	Correlator    string
	Operation     string
	Alarm         string
}

ApplicationContext contains the context of a request for logging and functional purposes.

func GetApplicationContext

func GetApplicationContext(ctx context.Context) *ApplicationContext

GetApplicationContext retrieves the ApplicationContext from standard context.

type LogContext

type LogContext struct {
	// contains filtered or unexported fields
}

LogContext stores the logger in the Context.

Jump to

Keyboard shortcuts

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