Documentation ¶
Index ¶
- func EmptyField() map[string]interface{}
- type Default
- func (d *Default) Debug(ctx context.Context, msg string, options ...Field)
- func (d *Default) Error(ctx context.Context, msg string, options ...Field)
- func (d *Default) Fatal(ctx context.Context, msg string, options ...Field)
- func (d *Default) GetInstance() interface{}
- func (d *Default) Info(ctx context.Context, msg string, options ...Field)
- func (d *Default) Panic(ctx context.Context, msg string, options ...Field)
- func (d *Default) Warn(ctx context.Context, msg string, options ...Field)
- type Field
- type ILogger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EmptyField ¶
func EmptyField() map[string]interface{}
Types ¶
type Default ¶
type Default struct{}
Default is a struct that wraps the default logger from the "log" package. It satisfied logger.ILogger interface and provides additional methods for logging with context and options.
It is used as a fallback logger when the zap logger is not available.
func NewDefault ¶
func NewDefault() *Default
NewDefault creates a new instance of Default logger using Go's native logger.
func (*Default) GetInstance ¶
func (d *Default) GetInstance() interface{}
type Field ¶
type Field func() map[string]interface{}
Field is a function type that returns a map of string keys to interface{} values. It is used to provide additional metadata for logging. The function is expected to return a map where each key-value pair represents a field to be logged.
func WithFields ¶
WithFields creates an option that contains the metadata.
type ILogger ¶
type ILogger interface { // GetInstance returns the underlying logger instance. GetInstance() interface{} // Debug logs a message at DebugLevel. Debug(ctx context.Context, msg string, fields ...Field) // Info logs a message at InfoLevel. Info(ctx context.Context, msg string, fields ...Field) // Warn logs a message at WarnLevel. Warn(ctx context.Context, msg string, fields ...Field) // Error logs a message at ErrorLevel. Error(ctx context.Context, msg string, fields ...Field) // Fatal logs a message at FatalLevel. Fatal(ctx context.Context, msg string, fields ...Field) // Panic logs a message at PanicLevel. Panic(ctx context.Context, msg string, fields ...Field) }
Click to show internal directories.
Click to hide internal directories.