log

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2018 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

View Source
const (
	LevelFatal = logrus.FatalLevel
	LevelPanic = logrus.PanicLevel
	LevelError = logrus.ErrorLevel
	LevelWarn  = logrus.WarnLevel
	LevelInfo  = logrus.InfoLevel
	LevelDebug = logrus.DebugLevel
)

Variables

log levels

View Source
var Nothing int

Nothing is dummy variable for import error

Functions

func Debug

func Debug(v ...interface{})

Debug logs development information

func Dump

func Dump(v ...interface{})

Dump prints dump variable in console

func Error

func Error(v ...interface{})

Error logs serious error

func Header(v ...interface{})

Header prints separator in console

func Info

func Info(v ...interface{})

Info logs information

func Json added in v0.4.1

func Json(v ...interface{})

Json prints data on json format in console

func Mark

func Mark(i ...int)

Mark prints trace info in console

func Print

func Print(v interface{})

Print prints variable information in console

func SetGlobalFormatter added in v0.4.0

func SetGlobalFormatter(f logrus.Formatter)

SetGlobalFormatter sets Fomatter.

func SetGlobalLogLevel added in v0.4.0

func SetGlobalLogLevel(l logrus.Level)

SetGlobalLogLevel sets log level.

func Warn

func Warn(v ...interface{})

Error logs warning

Types

type Logger added in v0.4.0

type Logger struct {
	*logrus.Logger
}

Logger is wrapper struct of *logrus.Logger.

func NewLogger added in v0.4.0

func NewLogger() *Logger

NewLogger returns initialized *Logger.

func (*Logger) DisableOutput added in v0.4.0

func (l *Logger) DisableOutput()

DisableOutput disables output.

func (*Logger) NewPacket added in v0.4.0

func (l *Logger) NewPacket() Packet

NewPacket creates Packet with Logger.

func (*Logger) SetFormatter added in v0.4.0

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

SetFormatter sets Fomatter.

func (*Logger) SetLogLevel added in v0.4.0

func (l *Logger) SetLogLevel(lv logrus.Level)

SetLogLevel sets log level.

func (*Logger) SetOutput added in v0.4.0

func (l *Logger) SetOutput(w io.Writer)

SetOutput sets output writer.

type Packet

type Packet struct {
	*Logger

	Title   string
	Data    interface{}
	Err     error
	Request *http.Request
	Context context.Context
	SQL     string
	Engine  string
	UserID  string
	Tag     string

	Trace     int // stacktrace depth
	TraceSkip int
	TraceData interface{}
	NoTrace   bool

	DataList []interface{}
}

Packet is struct for log data

func (*Packet) AddData

func (p *Packet) AddData(d ...interface{}) *Packet

AddData adds data for logging

func (Packet) Debug

func (p Packet) Debug()

Debug logs debug-level log.

func (Packet) Error

func (p Packet) Error()

Error logs error-level log.

func (Packet) Fatal

func (p Packet) Fatal()

Fatal logs fatal-level log.

func (Packet) Info

func (p Packet) Info()

Info logs info-level log.

func (Packet) Panic

func (p Packet) Panic()

Panic logs panic-level log.

func (*Packet) SetLogger added in v0.4.0

func (p *Packet) SetLogger(l *Logger) *Packet

SetLogger sets Logger.

func (Packet) Warn

func (p Packet) Warn()

Warn logs warn-level log.

type StackTrace

type StackTrace struct {
	File     string
	Module   string
	Function string
	Line     int
	Path     string
}

func GetTraces

func GetTraces(depth, skip int) []StackTrace

func Trace

func Trace(depth int) (StackTrace, bool)

func (StackTrace) String

func (s StackTrace) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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