meshlogger

package
v0.4.26 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2023 License: MIT Imports: 12 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Format

type Format int
const (
	TextFormatter Format = iota
	JSONFormatter
	SyslogFormatter
)

type Hook

type Hook interface {
	Levels() []logrus.Level
	Fire(*logrus.Entry) error
}

type LevelHooks

type LevelHooks map[logrus.Level][]Hook

func (LevelHooks) Add

func (hooks LevelHooks) Add(hook Hook)

func (LevelHooks) Fire

func (hooks LevelHooks) Fire(level logrus.Level, entry *logrus.Entry) error

type LogLevel added in v0.4.8

type LogLevel int
const (
	DebugLevel LogLevel = iota
	InfoLevel
	WarnLevel
	ErrorLevel
)

type Logger

type Logger interface {
	SetLogLevel(level LogLevel)
	GetLogLevel() LogLevel
	SetLogFormatter(formatter TerminalFormatter)

	Info(msg string, fields ...interface{})
	Debug(msg string, fields ...interface{})
	Warn(err error)
	Error(err error)

	Infof(format string, args ...interface{})
	Debugf(format string, args ...interface{})
	Errorf(format string, args ...interface{})
	Warnf(format string, args ...interface{})

	AddHook(hook Hook)
	DatabaseLogger() gormlogger.Interface
	XormLogger() core.ILogger
}

func NewLogger

func NewLogger(appname string, opts Options) (Logger, error)

type Options

type Options struct {
	Format     Format
	DebugLevel bool
	Output     io.Writer
}

type TerminalFormatter added in v0.4.14

type TerminalFormatter struct {
	TimestampFormat  string
	NoUppercaseLevel bool
	CallerFirst      bool
	NoColors         bool
	ShowFullLevel    bool
	NoFieldsSpace    bool
	NoFieldsColors   bool
	FieldsOrder      []string
	TrimMessages     bool
}

func (*TerminalFormatter) Format added in v0.4.14

func (f *TerminalFormatter) Format(entry *logrus.Entry) ([]byte, error)

Format formats the log entry using lipgloss styles based on the log level

type XormLogger added in v0.4.25

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

func (*XormLogger) Debug added in v0.4.25

func (xl *XormLogger) Debug(v ...interface{})

Debug implements core.ILogger.

func (*XormLogger) Debugf added in v0.4.25

func (xl *XormLogger) Debugf(format string, v ...interface{})

func (*XormLogger) Error added in v0.4.25

func (xl *XormLogger) Error(v ...interface{})

Error implements core.ILogger.

func (*XormLogger) Errorf added in v0.4.25

func (xl *XormLogger) Errorf(format string, v ...interface{})

func (*XormLogger) Info added in v0.4.25

func (xl *XormLogger) Info(v ...interface{})

Info implements core.ILogger.

func (*XormLogger) Infof added in v0.4.25

func (xl *XormLogger) Infof(format string, v ...interface{})

func (*XormLogger) IsShowSQL added in v0.4.25

func (xl *XormLogger) IsShowSQL() bool

IsShowSQL implements core.ILogger.

func (*XormLogger) Level added in v0.4.25

func (xl *XormLogger) Level() core.LogLevel

Level returns the logger level

func (*XormLogger) SetLevel added in v0.4.25

func (xl *XormLogger) SetLevel(l core.LogLevel)

SetLevel sets the logger level

func (*XormLogger) ShowSQL added in v0.4.25

func (xl *XormLogger) ShowSQL(show ...bool)

ShowSQL sets whether SQL should be shown or not

func (*XormLogger) Warn added in v0.4.25

func (xl *XormLogger) Warn(v ...interface{})

Warn implements core.ILogger.

func (*XormLogger) Warnf added in v0.4.25

func (xl *XormLogger) Warnf(format string, v ...interface{})

Jump to

Keyboard shortcuts

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