Documentation
¶
Overview ¶
Package logx is a simple logging lib that shows calling func line, info and provide context for tracing.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Error ¶
Error will log and return first parameter p1 Example 1: logs.Error(err) Example 2 with extra request info: logs.Error(err, logs.F("myRequest",req)) Example 3: logs.Error(errx.Wrap(errs.ErrUnauthorized, errs.ErrUserNotFound, err))
func Info ¶
Info will log and return first parameter p Example 1: logs.Info(err) Example 2 with extra request info: logs.Error(err, logs.F("myRequest",req)) Example 3: logs.Info(errx.Wrap(errs.ErrUnauthorized, errs.ErrUserNotFound, err), logs.F("myRequest",req))
func SetLogger ¶
func SetLogger(ls ...ExternalLogger)
SetLogger will set external loggers. This should be set ONCE only.
Types ¶
type ExternalLogger ¶
type ExternalLogger interface { Info(ctx context.Context, v ...any) Warn(ctx context.Context, v ...any) Error(ctx context.Context, v ...any) }
func NewLoggerLocal ¶
func NewLoggerLocal() ExternalLogger
type LoggerLocal ¶
type LoggerLocal struct {
// contains filtered or unexported fields
}
func (LoggerLocal) Error ¶
func (l LoggerLocal) Error(_ context.Context, v ...interface{})
func (LoggerLocal) Info ¶
func (l LoggerLocal) Info(_ context.Context, v ...interface{})
func (LoggerLocal) Warn ¶
func (l LoggerLocal) Warn(_ context.Context, v ...interface{})