logger

package
v0.0.0-...-c8bc4d7 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2024 License: Apache-2.0 Imports: 8 Imported by: 2

Documentation

Index

Constants

View Source
const (
	JsonLogFormat = iota
	SyslogLogFormat
	TerminalLogFormat
)

Variables

View Source
var (
	ErrControllerCode = "11071"
)

Functions

func ErrController

func ErrController(err error, msg string) error

Types

type Controller

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

func (*Controller) Enabled

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

func (*Controller) Error

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

func (*Controller) Info

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

func (*Controller) Init

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

func (*Controller) V

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

func (*Controller) WithName

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

func (*Controller) WithValues

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

type Database

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

func (*Database) Error

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

func (*Database) Info

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

func (*Database) LogMode

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

func (*Database) Trace

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

func (*Database) Warn

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)

	// 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

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

func (*Logger) DatabaseLogger

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) Info

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

func (*Logger) Warn

func (l *Logger) Warn(err error)

type Options

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

type TerminalFormatter

type TerminalFormatter struct{}

TerminalFormatter is exported

func (*TerminalFormatter) Format

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