logger

package
v0.7.14 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2024 License: Apache-2.0 Imports: 8 Imported by: 29

Documentation

Index

Constants

View Source
const (
	JsonLogFormat = iota
	SyslogLogFormat
	TerminalLogFormat
)

Variables

View Source
var (
	ErrControllerCode = "11071"
)

Functions

func ErrController added in v0.2.15

func ErrController(err error, msg string) error

Types

type Controller added in v0.1.31

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

func (*Controller) Enabled added in v0.1.31

func (c *Controller) Enabled(level int) bool

func (*Controller) Error added in v0.1.31

func (c *Controller) Error(err error, msg string, keysAndValues ...interface{})

func (*Controller) Info added in v0.1.31

func (c *Controller) Info(level int, msg string, keysAndValues ...interface{})

func (*Controller) Init added in v0.5.14

func (c *Controller) Init(info logr.RuntimeInfo)

func (*Controller) V added in v0.1.31

func (c *Controller) V(level int) *Controller

func (*Controller) WithName added in v0.1.31

func (c *Controller) WithName(name string) logr.LogSink

func (*Controller) WithValues added in v0.1.31

func (c *Controller) WithValues(keysAndValues ...interface{}) logr.LogSink

type Database added in v0.2.4

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

func (*Database) Error added in v0.2.4

func (c *Database) Error(ctx context.Context, msg string, data ...interface{})

func (*Database) Info added in v0.2.4

func (c *Database) Info(ctx context.Context, msg string, data ...interface{})

func (*Database) LogMode added in v0.2.4

func (c *Database) LogMode(level gormlogger.LogLevel) gormlogger.Interface

func (*Database) Trace added in v0.2.4

func (c *Database) Trace(ctx context.Context, begin time.Time, fc func() (string, int64), err error)

func (*Database) Warn added in v0.2.4

func (c *Database) Warn(ctx context.Context, msg string, data ...interface{})

type Format

type Format int

type Handler

type Handler interface {
	Info(description ...interface{})
	Debug(description ...interface{})
	Warn(err error)
	Error(err error)
	SetLevel(level logrus.Level)
	GetLevel() logrus.Level
	UpdateLogOutput(w io.Writer)
	// Kubernetes Controller compliant logger
	ControllerLogger() logr.Logger
	DatabaseLogger() gormlogger.Interface
}

func New

func New(appname string, opts Options) (Handler, error)

type Logger

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

func (*Logger) ControllerLogger added in v0.1.31

func (l *Logger) ControllerLogger() logr.Logger

func (*Logger) DatabaseLogger added in v0.2.4

func (l *Logger) DatabaseLogger() gormlogger.Interface

func (*Logger) Debug

func (l *Logger) Debug(description ...interface{})

func (*Logger) Error

func (l *Logger) Error(err error)

func (*Logger) GetLevel added in v0.7.5

func (l *Logger) GetLevel() logrus.Level

func (*Logger) Info

func (l *Logger) Info(description ...interface{})

func (*Logger) SetLevel added in v0.7.5

func (l *Logger) SetLevel(level logrus.Level)

func (*Logger) UpdateLogOutput added in v0.7.12

func (l *Logger) UpdateLogOutput(output io.Writer)

func (*Logger) Warn

func (l *Logger) Warn(err error)

type Options

type Options struct {
	Format   Format
	LogLevel int
	Output   io.Writer
}

type TerminalFormatter added in v0.5.1

type TerminalFormatter struct{}

TerminalFormatter is exported

func (*TerminalFormatter) Format added in v0.5.1

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

Format defined the format of output for Logrus logs Format is exported

Jump to

Keyboard shortcuts

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