logger

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LogFields

type LogFields map[string]interface{}

LogFields holds the detail to be logged.

type LogLevel

type LogLevel int8

LogLevel defines log priorities.

const (
	LogLevelDebug LogLevel = iota
	LogLevelInfo
	LogLevelError
	LogLevelPanic
	LogDisabled
)

type Logger

type Logger interface {
	SetLogLevel(level LogLevel)
	GetLogLevel() LogLevel

	Panic(message string)
	Panicf(format string, values ...interface{})
	Error(message string)
	Errorf(format string, values ...interface{})
	Info(message string)
	Infof(format string, values ...interface{})
	Debug(message string)
	Debugf(format string, values ...interface{})

	WithInterface(key string, value interface{}) Logger
	WithFields(fields LogFields) Logger
	WithPrefix(prefix string) Logger
}

type LoggerConfig

type LoggerConfig struct {
	LogPath string `json:"LogPath"`
	Level   int8   `json:"Level"`
	Color   bool   `json:"Color"`
}

func DefaultConfig

func DefaultConfig() LoggerConfig

func (LoggerConfig) IsValid

func (cfg LoggerConfig) IsValid() (bool, error)

type ZeroLogger

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

ZeroLogger implements Logger interface and provide logging service using zerolog.

func NewZeroLogger

func NewZeroLogger(logFile string, prefix ...string) *ZeroLogger

func NewZeroLoggerWithColor

func NewZeroLoggerWithColor(logFile string, prefix ...string) *ZeroLogger

func (*ZeroLogger) Debug

func (logger *ZeroLogger) Debug(message string)

func (*ZeroLogger) Debugf

func (logger *ZeroLogger) Debugf(format string, values ...interface{})

func (*ZeroLogger) Error

func (logger *ZeroLogger) Error(message string)

func (*ZeroLogger) Errorf

func (logger *ZeroLogger) Errorf(format string, values ...interface{})

func (*ZeroLogger) GetLogLevel

func (logger *ZeroLogger) GetLogLevel() LogLevel

func (*ZeroLogger) Info

func (logger *ZeroLogger) Info(message string)

func (*ZeroLogger) Infof

func (logger *ZeroLogger) Infof(format string, values ...interface{})

func (*ZeroLogger) Panic

func (logger *ZeroLogger) Panic(message string)

func (*ZeroLogger) Panicf

func (logger *ZeroLogger) Panicf(format string, values ...interface{})

func (*ZeroLogger) SetLogLevel

func (logger *ZeroLogger) SetLogLevel(level LogLevel)

func (*ZeroLogger) WithFields

func (logger *ZeroLogger) WithFields(fields LogFields) Logger

func (*ZeroLogger) WithInterface

func (logger *ZeroLogger) WithInterface(key string, value interface{}) Logger

func (*ZeroLogger) WithPrefix

func (logger *ZeroLogger) WithPrefix(prefix string) Logger

Jump to

Keyboard shortcuts

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