Documentation ¶
Index ¶
- func AtLevel(ctx context.Context, level logf.Level, fn func(logf.LogFunc))
- func Debug(ctx context.Context, text string, fs ...logf.Field)
- func Error(ctx context.Context, text string, fs ...logf.Field)
- func Get(ctx context.Context) *logf.Logger
- func Info(ctx context.Context, text string, fs ...logf.Field)
- func MustAtLevel(ctx context.Context, level logf.Level, fn func(logf.LogFunc))
- func MustDebug(ctx context.Context, text string, fs ...logf.Field)
- func MustError(ctx context.Context, text string, fs ...logf.Field)
- func MustGet(ctx context.Context) *logf.Logger
- func MustInfo(ctx context.Context, text string, fs ...logf.Field)
- func MustWarn(ctx context.Context, text string, fs ...logf.Field)
- func MustWith(ctx context.Context, fields ...logf.Field) context.Context
- func MustWithCaller(ctx context.Context) context.Context
- func MustWithCallerSkip(ctx context.Context, n int) context.Context
- func MustWithLevel(ctx context.Context, level logf.LevelCheckerGetter) context.Context
- func MustWithName(ctx context.Context, name string) context.Context
- func New(parent context.Context, logger *logf.Logger) context.Context
- func Warn(ctx context.Context, text string, fs ...logf.Field)
- func With(ctx context.Context, fields ...logf.Field) context.Context
- func WithCaller(ctx context.Context) context.Context
- func WithCallerSkip(ctx context.Context, n int) context.Context
- func WithLevel(ctx context.Context, level logf.LevelCheckerGetter) context.Context
- func WithName(ctx context.Context, name string) context.Context
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AtLevel ¶
AtLevel calls the given fn if logging a message at the specified level is enabled, passing a logf.LogFunc with the bound level or does nothing if there is no logf.Logger associated with ctx.
func Debug ¶
Debug logs a debug message with the given text, optional fields and fields passed to the logf.Logger using With function or logs nothing if no logf.Logger is associated with ctx.
func Error ¶
Error logs an error message with the given text, optional fields and fields passed to the logf.Logger using With function or logs nothing if no logf.Logger is associated with ctx.
func Get ¶
Get returns the logf.Logger associated with ctx or log.DisabledLogger() if no value is associated. Successive calls to Get return the same result.
func Info ¶
Info logs an info message with the given text, optional fields and fields passed to the logf.Logger using With function or logs nothing if no logf.Logger is associated with ctx.
func MustAtLevel ¶
MustAtLevel calls the given fn if logging a message at the specified level is enabled, passing a logf.LogFunc with the bound level or panics if there is no logf.Logger associated with ctx.
func MustDebug ¶
MustDebug logs a debug message with the given text, optional fields and fields passed to the logf.Logger using With function or panics if no logf.Logger is associated with ctx.
func MustError ¶
MustError logs an error message with the given text, optional fields and fields passed to the logf.Logger using With function or panics if no logf.Logger is associated with ctx.
func MustGet ¶
MustGet returns the logf.Logger associated with ctx or panics if no value is associated. Successive calls to MustGet return the same result.
func MustInfo ¶
MustInfo logs an info message with the given text, optional fields and fields passed to the logf.Logger using With function or panics if no logf.Logger is associated with ctx.
func MustWarn ¶
MustWarn logs a warning message with the given text, optional fields and fields passed to the logf.Logger using With function or panics if no logf.Logger is associated with ctx.
func MustWith ¶
MustWith returns a new context.Context with provided fields appended to fields of logf.Logger associated with ctx or panics if no logf.Logger is associated with ctx.
func MustWithCaller ¶
MustWithCaller returns a new context.Context with a logf.Logger that adds a special annotation parameters to each logging message, such as the filename and line number of a caller or panics if no logf.Logger is associated with ctx.
func MustWithCallerSkip ¶
MustWithCallerSkip returns a new context.Context with a logf.Logger that adds a special annotation parameters with additional n skipped frames to each logging message, such as the filename and line number of a caller or panics if no logf.Logger is associated with ctx.
func MustWithLevel ¶ added in v1.4.2
MustWithLevel returns a new context.Context with a new logf.Logger with the given additional level checker. MustWithLevel panics if no logf.Logger is associated with ctx. Name separator is a period.
func MustWithName ¶
MustWithName returns a new context.Context with a new logf.Logger adding the given name to the original one or panics if no logf.Logger is associated with ctx. Name separator is a period.
func New ¶
New returns a new context.Context with the given logger associated with it.
Note: the given logger will hide any other logger which was associated with this context before.
func Warn ¶
Warn logs a warning message with the given text, optional fields and fields passed to the logf.Logger using With function or logs nothing if no logf.Logger is associated with ctx.
func With ¶
With returns a new context.Context with new logf.Logger inside with provided fields appended to current logf.Logger associated with ctx If there is no logf.Logger is associated with ctx, logf.DisabledLogger() is used as a base logger.
func WithCaller ¶
WithCaller returns a new context.Context with a new logf.Logger that adds a special annotation parameters to each logging message, such as the filename and line number of a caller. If there is no logf.Logger is associated with ctx, logf.DisabledLogger() is used as a base logger.
func WithCallerSkip ¶
WithCallerSkip returns a new context.Context with a new logf.Logger that adds a special annotation parameters with additional n skipped frames to each logging message, such as the filename and line number of a caller. If there is no logf.Logger is associated with ctx, logf.DisabledLogger() is used as a base logger.
func WithLevel ¶ added in v1.4.1
WithLevel returns a new context.Context with a new logf.Logger with the given additional level checker. If there is no logf.Logger is associated with ctx, logf.DisabledLogger() is used as a base logger.
Types ¶
This section is empty.