logger

package module
v0.0.0-...-20206c2 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

README

package logger

Basic wrapper around github.com/sirupsen/logrus

See tests for examples.

Documentation

Index

Constants

View Source
const (
	DebugLevel int = 0
	InfoLevel  int = 1
	WarnLevel  int = 2
	ErrorLevel int = 3
	FatalLevel int = 4
	PanicLevel int = 5

	TextFormat string = "text"
	JSONFormat string = "json"

	TimestampFieldName string = "timestamp"
	MessageFieldName   string = "message"
)

Variables

View Source
var (
	NoFields = make(map[string]interface{})
)

Functions

func GetLogLevel

func GetLogLevel(level string) int

Types

type Fields

type Fields map[string]interface{}

type Logger

type Logger struct {
	Logger *logrus.Logger
	// contains filtered or unexported fields
}

func New

func New(out io.Writer, level int, fmt string) (*Logger, error)

func NewDefault

func NewDefault() (*Logger, error)

func NewLogfile

func NewLogfile(filename string, level int, fmt string) (*Logger, error)

func (*Logger) Debug

func (this *Logger) Debug(args ...interface{})

func (*Logger) DebugWithFields

func (this *Logger) DebugWithFields(fields Fields, args ...interface{})

func (*Logger) Debugf

func (this *Logger) Debugf(fmt string, args ...interface{})

func (*Logger) Error

func (this *Logger) Error(args ...interface{})

func (*Logger) ErrorWithFields

func (this *Logger) ErrorWithFields(fields Fields, args ...interface{})

func (*Logger) Errorf

func (this *Logger) Errorf(fmt string, args ...interface{})

func (*Logger) Fatal

func (this *Logger) Fatal(args ...interface{})

func (*Logger) FatalWithFields

func (this *Logger) FatalWithFields(fields Fields, args ...interface{})

func (*Logger) Fatalf

func (this *Logger) Fatalf(fmt string, args ...interface{})

func (*Logger) GetLogrus

func (this *Logger) GetLogrus() *logrus.Logger

func (*Logger) Info

func (this *Logger) Info(args ...interface{})

func (*Logger) InfoWithFields

func (this *Logger) InfoWithFields(fields Fields, args ...interface{})

func (*Logger) Infof

func (this *Logger) Infof(fmt string, args ...interface{})

func (*Logger) Panic

func (this *Logger) Panic(args ...interface{})

func (*Logger) PanicWithFields

func (this *Logger) PanicWithFields(fields Fields, args ...interface{})

func (*Logger) Panicf

func (this *Logger) Panicf(fmt string, args ...interface{})

func (*Logger) SetFormatter

func (this *Logger) SetFormatter(fmt string) error

func (*Logger) SetLogLevel

func (this *Logger) SetLogLevel(level int) error

func (*Logger) Warn

func (this *Logger) Warn(args ...interface{})

func (*Logger) WarnWithFields

func (this *Logger) WarnWithFields(fields Fields, args ...interface{})

func (*Logger) Warnf

func (this *Logger) Warnf(fmt string, args ...interface{})

Jump to

Keyboard shortcuts

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