Documentation
¶
Index ¶
- Variables
- func Context(ctx context.Context, logger *log.Logger) context.Context
- func Debug(ctx context.Context, msg interface{}, keyvals ...interface{})
- func Debugf(ctx context.Context, format string, args ...interface{})
- func Error(ctx context.Context, msg interface{}, keyvals ...interface{})
- func Errorf(ctx context.Context, format string, args ...interface{})
- func From(ctx context.Context) *log.Logger
- func FromPrefix(ctx context.Context, prefix string) *log.Logger
- func Info(ctx context.Context, msg interface{}, keyvals ...interface{})
- func Infof(ctx context.Context, format string, args ...interface{})
- func ReportIf(msg string, call func() error)
- func SetupLogger()
- func Slog() *slog.Logger
- func ToSlog(logger *log.Logger) *slog.Logger
- func ToWriter(logger *log.Logger, opts ...log.StandardLogOptions) io.Writer
- func UpdateLogger(reportCaller bool, level, format string)
- func Warn(ctx context.Context, msg interface{}, keyvals ...interface{})
- func Warnf(ctx context.Context, format string, args ...interface{})
- func With(ctx context.Context, keyvals ...interface{}) *log.Logger
- func WithPrefix(ctx context.Context, prefix string) *log.Logger
- func Writer(opts ...log.StandardLogOptions) io.Writer
- type Enriched
Constants ¶
This section is empty.
Variables ¶
View Source
var ( LoggerConfigSet = config.New("logger").WithValidate(validateLogger) ReportCallerFlag = LoggerConfigSet.Bool("log.report-caller", false, "Whenever or not to output the file that outputs the log") LevelFlag = LoggerConfigSet.String("log.level", "info", "The debug level, levels are: debug, info, warn, error, fatal") FormatFlag = LoggerConfigSet.String("log.format", "text", "The format of the logging") )
Functions ¶
func FromPrefix ¶
From returns the possible injected logger in the context, adding the given format
func SetupLogger ¶
func SetupLogger()
func UpdateLogger ¶
func With ¶
With returns a logger with the given key-value pairs attached, based on the logger extracted from the provided context.
func WithPrefix ¶
WithPrefix returns a logger with the given prefix attached, based on the logger extracted from the provided context.
Types ¶
type Enriched ¶
type Enriched struct {
// contains filtered or unexported fields
}
func (Enriched) FromUpdate ¶
func (Enriched) WithPrefix ¶
Click to show internal directories.
Click to hide internal directories.