Documentation
¶
Index ¶
- Variables
- func AddEntryToContext(ctx context.Context, entry *logrus.Entry) context.Context
- func AddLoggerToContext(log *logrus.Logger, ctx context.Context) context.Context
- func GetEntryFromContextOrDefault(ctx context.Context) *logrus.Entry
- func GetEntryFromEchoContext(c echo.Context) *logrus.Entry
- func GetLoggerFromContextOrDefault(ctx context.Context) *logrus.Logger
- type ContextLoggerKey
- type RequestIdKey
Constants ¶
This section is empty.
Variables ¶
View Source
var CtxLoggerKey = &ContextLoggerKey{}
View Source
var ReqIdKey = &RequestIdKey{}
Functions ¶
func AddEntryToContext ¶
func AddLoggerToContext ¶
Adds a logger to a context. Returns the new context with the logger attached.
func GetEntryFromContextOrDefault ¶
Gets a logrus entry from the given context. If one
func GetEntryFromEchoContext ¶
Gets a logrus entry from the Echo handler context. If none has been added yet, a new entry is created along with a UUID so that the logging for this unique request can be tracked.
Types ¶
type ContextLoggerKey ¶
type ContextLoggerKey struct{}
type RequestIdKey ¶
type RequestIdKey struct{}
Click to show internal directories.
Click to hide internal directories.