logx

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 27, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultLogger

type DefaultLogger struct{}

DefaultLogger - Logger implementation that does nothing.

func (*DefaultLogger) GetLogger

func (nl *DefaultLogger) GetLogger() interface{}

GetLogger noop.

func (*DefaultLogger) LogDebug

func (nl *DefaultLogger) LogDebug(ctx context.Context, msg string)

LogDebug noop.

func (*DefaultLogger) LogError

func (nl *DefaultLogger) LogError(ctx context.Context, msg string, errs ...error)

LogError noop.

func (*DefaultLogger) LogFatal

func (nl *DefaultLogger) LogFatal(ctx context.Context, msg string, errs ...error)

LogFatal noop.

func (*DefaultLogger) LogInfo

func (nl *DefaultLogger) LogInfo(ctx context.Context, msg string)

LogInfo noop.

func (*DefaultLogger) LogPanic

func (nl *DefaultLogger) LogPanic(ctx context.Context, msg string, errs ...error)

LogPanic noop.

func (*DefaultLogger) LogWarning

func (nl *DefaultLogger) LogWarning(ctx context.Context, msg string, errs ...error)

LogWarning noop.

type Logger

type Logger interface {
	// LogInfo logs a message at Info level.
	LogInfo(ctx context.Context, msg string)
	// LogDebug logs a message at Debug level.
	LogDebug(ctx context.Context, msg string)
	// LogWarning logs a message at Warning level.
	LogWarning(ctx context.Context, msg string, errs ...error)
	// LogError logs a message at Error level.
	LogError(ctx context.Context, msg string, errs ...error)
	// LogPanic logs a message at Panic level then panics.
	LogPanic(ctx context.Context, msg string, errs ...error)
	// LogFatal logs a message at Fatal Level.
	// The logger then calls os.Exit(1), even if logging at FatalLevel is
	// disabled.
	LogFatal(ctx context.Context, msg string, errs ...error)

	GetLogger() interface{}
}

Logger - logger interface.

func GetLogger

func GetLogger() Logger

GetLogger - returns an instance of the Logger. If called before SetupLogger a no-op logger will be returned.

func SetupLogger

func SetupLogger(config configx.Config) Logger

SetupLogger sets up a new Logger with a service name override.

type ServiceContext

type ServiceContext struct {
	Environment string `json:"environment"`
	Version     string `json:"version"`
}

type ZeroLogWrapper

type ZeroLogWrapper struct {
	// contains filtered or unexported fields
}

func (*ZeroLogWrapper) GetLogger

func (lm *ZeroLogWrapper) GetLogger() interface{}

GetLogger - returns the underlying logger.

func (*ZeroLogWrapper) LogDebug

func (lm *ZeroLogWrapper) LogDebug(ctx context.Context, msg string)

func (*ZeroLogWrapper) LogError

func (lm *ZeroLogWrapper) LogError(ctx context.Context, msg string, errs ...error)

func (*ZeroLogWrapper) LogFatal

func (lm *ZeroLogWrapper) LogFatal(ctx context.Context, msg string, errs ...error)

func (*ZeroLogWrapper) LogInfo

func (lm *ZeroLogWrapper) LogInfo(ctx context.Context, msg string)

func (*ZeroLogWrapper) LogPanic

func (lm *ZeroLogWrapper) LogPanic(ctx context.Context, msg string, errs ...error)

func (*ZeroLogWrapper) LogWarning

func (lm *ZeroLogWrapper) LogWarning(ctx context.Context, msg string, errs ...error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL