log

package
v0.0.0-...-c9641dd Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func Close

func Close()

func Debug

func Debug(args ...interface{})

func Debugf

func Debugf(format string, args ...interface{})

func Error

func Error(args ...interface{})

func Errorf

func Errorf(format string, args ...interface{})

func Fatal

func Fatal(args ...interface{})

func Fatalf

func Fatalf(format string, args ...interface{})

func Info

func Info(args ...interface{})

func Infof

func Infof(format string, args ...interface{})

func IsDebugEnabled

func IsDebugEnabled() bool

func LogLevel

func LogLevel(level string) logrus.Level

func Setup

func Setup(program string, logDir string, level logrus.Level) error

func Trace

func Trace(args ...interface{})

func Tracef

func Tracef(format string, args ...interface{})

func Warn

func Warn(args ...interface{})

func Warnf

func Warnf(format string, args ...interface{})

func Warning

func Warning(args ...interface{})

func Warningf

func Warningf(format string, args ...interface{})

Types

type Formatter

type Formatter struct {
	// FieldsOrder - default: fields sorted alphabetically
	FieldsOrder []string

	// TimestampFormat - default: time.StampMilli = "Jan _2 15:04:05.000"
	TimestampFormat string

	// HideKeys - show [fieldValue] instead of [fieldKey:fieldValue]
	HideKeys bool

	// NoColors - disable colors
	NoColors bool

	// NoFieldsColors - apply colors only to the level, default is level + fields
	NoFieldsColors bool

	// NoFieldsSpace - no space between fields
	NoFieldsSpace bool

	// ShowFullLevel - show a full level [WARNING] instead of [WARN]
	ShowFullLevel bool

	// NoUppercaseLevel - no upper case for level value
	NoUppercaseLevel bool

	// TrimMessages - trim whitespaces on messages
	TrimMessages func(s string) string

	// CallerFirst - print caller info first
	CallerFirst bool

	// CustomCallerFormatter - set custom formatter for caller info
	CustomCallerFormatter func(*runtime.Frame) string
}

Formatter - logrus formatter, implements logrus.Formatter

func NewFormatter

func NewFormatter() *Formatter

func (*Formatter) Format

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

Format an log entry

type Logger

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

func Mount

func Mount(logDir string, name string, level logrus.Level) (*Logger, error)

func (*Logger) AddHook

func (l *Logger) AddHook(hook logrus.Hook)

func (*Logger) Close

func (l *Logger) Close() error

func (*Logger) Logger

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

func (*Logger) Reload

func (l *Logger) Reload() error

func (*Logger) SetFormatter

func (l *Logger) SetFormatter(formatter logrus.Formatter)

func (*Logger) SetLevel

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

func (*Logger) SetOutput

func (l *Logger) SetOutput(path string) error

func (*Logger) SetReportCaller

func (l *Logger) SetReportCaller(reportCaller bool)

Jump to

Keyboard shortcuts

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