log

package module
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2022 License: GPL-3.0 Imports: 11 Imported by: 46

Documentation

Index

Constants

View Source
const (
	FullDateFormat = "2006-01-02T15:04:05.000-07:00"
	Code           = "$$code"
)

Variables

View Source
var LevelsString = map[logrus.Level]string{
	logrus.PanicLevel: "PANIC",
	logrus.FatalLevel: "FATAL",
	logrus.ErrorLevel: "ERROR",
	logrus.WarnLevel:  "WARN ",
	logrus.InfoLevel:  "INFO ",
	logrus.DebugLevel: "DEBUG",
	logrus.TraceLevel: "TRACE",
}
View Source
var LevelsStringColored = map[logrus.Level]string{
	logrus.PanicLevel: fmt.Sprintf("\x1b[%dm%s\x1b[0m", red, "PANIC"),
	logrus.FatalLevel: fmt.Sprintf("\x1b[%dm%s\x1b[0m", redLight, "FATAL"),
	logrus.ErrorLevel: fmt.Sprintf("\x1b[%dm%s\x1b[0m", red, "ERROR"),
	logrus.WarnLevel:  fmt.Sprintf("\x1b[%dm%s\x1b[0m", yellow, "WARN "),
	logrus.InfoLevel:  fmt.Sprintf("\x1b[%dm%s\x1b[0m", cyanLight, "INFO "),
	logrus.DebugLevel: fmt.Sprintf("\x1b[%dm%s\x1b[0m", cyan, "DEBUG"),
	logrus.TraceLevel: fmt.Sprintf("\x1b[%dm%s\x1b[0m", cyan, "TRACE"),
}

Functions

func Debug

func Debug(code int, message interface{})

func Debugf

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

func Error

func Error(code int, message interface{})

func Errorf

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

func Fatal

func Fatal(code int, message interface{})

func Fatalf

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

func GetLevel

func GetLevel() logrus.Level

func GetOutput

func GetOutput() io.Writer

func Info

func Info(code int, message interface{})

func Infof

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

func IsLevelEnabled

func IsLevelEnabled(level logrus.Level) bool

func Log

func Log(level logrus.Level, code int, message interface{})

func Logf

func Logf(level logrus.Level, code int, format string, args ...interface{})

func Panic

func Panic(code int, message interface{})

func Panicf

func Panicf(code int, format string, args ...interface{})

func SetColored

func SetColored(colored bool)

func SetLevel

func SetLevel(level string) error

func SetOutput

func SetOutput(output io.Writer)

func Trace

func Trace(code int, message interface{})

func Tracef

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

func Warn

func Warn(code int, message interface{})

func Warnf

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

Types

type Entry

type Entry struct {
	Time    time.Time
	Level   string
	Code    int
	Message string
	Data    map[string]string
}

func ParseLog

func ParseLog(log string) (Entry, error)

type Formatter

type Formatter struct {
}

func (*Formatter) Format

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

type Metadata

type Metadata logrus.Fields

func WithMetadata

func WithMetadata(metadata Metadata) *Metadata

func (*Metadata) Debug

func (m *Metadata) Debug(code int, message interface{})

func (*Metadata) Debugf

func (m *Metadata) Debugf(code int, format string, args ...interface{})

func (*Metadata) Error

func (m *Metadata) Error(code int, message interface{})

func (*Metadata) Errorf

func (m *Metadata) Errorf(code int, format string, args ...interface{})

func (*Metadata) Fatal

func (m *Metadata) Fatal(code int, message interface{})

func (*Metadata) Fatalf

func (m *Metadata) Fatalf(code int, format string, args ...interface{})

func (*Metadata) Info

func (m *Metadata) Info(code int, message interface{})

func (*Metadata) Infof

func (m *Metadata) Infof(code int, format string, args ...interface{})

func (*Metadata) Log

func (m *Metadata) Log(level logrus.Level, code int, message interface{})

func (*Metadata) Logf

func (m *Metadata) Logf(level logrus.Level, code int, format string, args ...interface{})

func (*Metadata) Panic

func (m *Metadata) Panic(code int, message interface{})

func (*Metadata) Panicf

func (m *Metadata) Panicf(code int, format string, args ...interface{})

func (*Metadata) Trace

func (m *Metadata) Trace(code int, message interface{})

func (*Metadata) Tracef

func (m *Metadata) Tracef(code int, format string, args ...interface{})

func (*Metadata) Warn

func (m *Metadata) Warn(code int, message interface{})

func (*Metadata) Warnf

func (m *Metadata) Warnf(code int, format string, args ...interface{})

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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