Documentation ¶
Index ¶
- Variables
- func Debug(ctx context.Context, v ...interface{})
- func Error(ctx context.Context, v ...interface{})
- func GetID(ctx context.Context) string
- func Info(ctx context.Context, v ...interface{})
- func SaveID(ctx context.Context, contextID string) context.Context
- func Setup(module string, writer io.Writer)
- func Warn(ctx context.Context, v ...interface{})
- func WithContextualValues(ctx context.Context, keysAndValues ...interface{}) context.Context
- type Logger
Constants ¶
This section is empty.
Variables ¶
View Source
var UnwrapContext = func(ctx context.Context) context.Context {
return ctx
}
ContextFunc is to get the actual log context from a custom context (gin-kit context) Override this function at the startup to avoid race condition
Functions ¶
func SaveID ¶
SaveID saves the context id to context variable and custom context store Return a copy of parent in which the value associated with key is
func WithContextualValues ¶
WithContextualValues sets contextual keys and values which will be shared with downstream functions Pass keys and values in log functions if you want to write keys/values for a single log keysAndValues must be string keys and arbitrary values, and extraneous ones are ignored
Types ¶
type Logger ¶
type Logger interface { Info(ctx context.Context, v ...interface{}) Warn(ctx context.Context, v ...interface{}) Debug(ctx context.Context, v ...interface{}) Error(ctx context.Context, v ...interface{}) Fields(ctx context.Context, kvList ...interface{}) Logger AddCallDepth(i int) Logger WithContextualValues(ctx context.Context, kvList ...interface{}) context.Context }
Logger defines interface for logger
Click to show internal directories.
Click to hide internal directories.