Documentation ¶
Index ¶
- func Debug(ctx context.Context, args ...any)
- func DebugFn(ctx context.Context, fn LogFn)
- func Debugf(ctx context.Context, format string, args ...any)
- func Error(ctx context.Context, args ...any)
- func ErrorFn(ctx context.Context, fn LogFn)
- func Errorf(ctx context.Context, format string, args ...any)
- func Fatal(ctx context.Context, args ...any)
- func FatalFn(ctx context.Context, fn LogFn)
- func Fatalf(ctx context.Context, format string, args ...any)
- func Info(ctx context.Context, args ...any)
- func InfoFn(ctx context.Context, fn LogFn)
- func Infof(ctx context.Context, format string, args ...any)
- func MustConfigure(opts ...ConfigOption)
- func Panic(ctx context.Context, args ...any)
- func PanicFn(ctx context.Context, fn LogFn)
- func Panicf(ctx context.Context, format string, args ...any)
- func SetFormatter(f logFormatterType)
- func SetLevel(level LogLevel)
- func SetOutput(out io.Writer)
- func Trace(ctx context.Context, args ...any)
- func TraceFn(ctx context.Context, fn LogFn)
- func Tracef(ctx context.Context, format string, args ...any)
- func Warn(ctx context.Context, args ...any)
- func WarnFn(ctx context.Context, fn LogFn)
- func Warnf(ctx context.Context, format string, args ...any)
- func WithField(ctx context.Context, key string, value any) context.Context
- func WithFields(ctx context.Context, fieldsToAdd map[string]any) context.Context
- type Config
- type ConfigOption
- type LogFn
- type LogLevel
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MustConfigure ¶
func MustConfigure(opts ...ConfigOption)
MustConfigure parses the logger conf and configures the application logger.
func SetFormatter ¶
func SetFormatter(f logFormatterType)
SetFormatter sets a custom log formatter function. It replaces the default log formatter with the provided one.
Types ¶
type Config ¶
type Config struct {
LogLevel string `config_format:"snake" config_default:"INFO" validate:"required,oneof=ERROR WARN INFO DEBUG TRACE"`
}
Config contains the values needed to configure the logger.
type ConfigOption ¶
type ConfigOption func(*loggerConfig)
ConfigOption sets values on the loggerConfig.
func WithConfigProvider ¶
func WithConfigProvider(provider func() (*Config, error)) ConfigOption
WithConfigProvider sets the provider for the config.Logger.
func WithOutputProvider ¶
func WithOutputProvider(provider func() (io.Writer, error)) ConfigOption
WithOutputProvider sets the logger output.
type LogLevel ¶
type LogLevel int
LogLevel represents the various log levels.
func ParseLevel ¶
ParseLevel parses a string into a LogLevel.
func (LogLevel) MarshalText ¶
MarshalText serializes the LogLevel into text.
func (*LogLevel) UnmarshalText ¶
UnmarshalText deserializes text into a LogLevel.
Click to show internal directories.
Click to hide internal directories.