log

package
v0.0.0-...-de1ad02 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2018 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Ldate         = log.Ldate
	Llongfile     = log.Llongfile
	Lmicroseconds = log.Lmicroseconds
	Lshortfile    = log.Lshortfile
	LstdFlags     = log.LstdFlags
	Ltime         = log.Ltime
)
View Source
const (
	TYPE_ERROR = LogType(1 << iota)
	TYPE_WARN
	TYPE_INFO
	TYPE_DEBUG
	TYPE_PANIC = LogType(^0)
)
View Source
const (
	LevelNone = LogLevel(1<<iota - 1)
	LevelError
	LevelWarn
	LevelInfo
	LevelDebug
	LevelAll = LevelDebug
)
View Source
const (
	MonthlyRolling  RollingFormat = "2006-01"
	DailyRolling                  = "2006-01-02"
	HourlyRolling                 = "2006-01-02-15"
	MinutelyRolling               = "2006-01-02-15-04"
	SecondlyRolling               = "2006-01-02-15-04-05"
)

Variables

View Source
var ErrClosedRollingFile = errors.New("rolling file is closed")
View Source
var StdLog = New(NopCloser(os.Stderr), "")

Functions

func Debug

func Debug(v ...interface{})

func DebugError

func DebugError(err error, v ...interface{})

func DebugErrorf

func DebugErrorf(err error, format string, v ...interface{})

func Debugf

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

func Error

func Error(v ...interface{})

func ErrorError

func ErrorError(err error, v ...interface{})

func ErrorErrorf

func ErrorErrorf(err error, format string, v ...interface{})

func Errorf

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

func Flags

func Flags() int

func Info

func Info(v ...interface{})

func InfoError

func InfoError(err error, v ...interface{})

func InfoErrorf

func InfoErrorf(err error, format string, v ...interface{})

func Infof

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

func NewRollingFile

func NewRollingFile(basePath string, rolling RollingFormat) (io.WriteCloser, error)

func NopCloser

func NopCloser(w io.Writer) io.WriteCloser

func Panic

func Panic(v ...interface{})

func PanicError

func PanicError(err error, v ...interface{})

func PanicErrorf

func PanicErrorf(err error, format string, v ...interface{})

func Panicf

func Panicf(format string, v ...interface{})

func Prefix

func Prefix() string

func Print

func Print(v ...interface{})

func Printf

func Printf(format string, v ...interface{})

func Println

func Println(v ...interface{})

func SetFlags

func SetFlags(flags int)

func SetLevel

func SetLevel(v LogLevel)

func SetLevelString

func SetLevelString(s string) bool

func SetPrefix

func SetPrefix(prefix string)

func SetTrace

func SetTrace(v LogLevel)

func Warn

func Warn(v ...interface{})

func WarnError

func WarnError(err error, v ...interface{})

func WarnErrorf

func WarnErrorf(err error, format string, v ...interface{})

func Warnf

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

Types

type LogLevel

type LogLevel int64

func (*LogLevel) ParseFromString

func (l *LogLevel) ParseFromString(s string) bool

func (*LogLevel) Set

func (l *LogLevel) Set(v LogLevel)

func (LogLevel) String

func (l LogLevel) String() string

func (*LogLevel) Test

func (l *LogLevel) Test(m LogType) bool

type LogType

type LogType int64

func (LogType) String

func (t LogType) String() string

type Logger

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

func New

func New(writer io.Writer, prefix string) *Logger

func (*Logger) Close

func (l *Logger) Close()

func (*Logger) Debug

func (l *Logger) Debug(v ...interface{})

func (*Logger) DebugError

func (l *Logger) DebugError(err error, v ...interface{})

func (*Logger) DebugErrorf

func (l *Logger) DebugErrorf(err error, format string, v ...interface{})

func (*Logger) Debugf

func (l *Logger) Debugf(format string, v ...interface{})

func (*Logger) Error

func (l *Logger) Error(v ...interface{})

func (*Logger) ErrorError

func (l *Logger) ErrorError(err error, v ...interface{})

func (*Logger) ErrorErrorf

func (l *Logger) ErrorErrorf(err error, format string, v ...interface{})

func (*Logger) Errorf

func (l *Logger) Errorf(format string, v ...interface{})

func (*Logger) Flags

func (l *Logger) Flags() int

func (*Logger) Info

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

func (*Logger) InfoError

func (l *Logger) InfoError(err error, v ...interface{})

func (*Logger) InfoErrorf

func (l *Logger) InfoErrorf(err error, format string, v ...interface{})

func (*Logger) Infof

func (l *Logger) Infof(format string, v ...interface{})

func (*Logger) Panic

func (l *Logger) Panic(v ...interface{})

func (*Logger) PanicError

func (l *Logger) PanicError(err error, v ...interface{})

func (*Logger) PanicErrorf

func (l *Logger) PanicErrorf(err error, format string, v ...interface{})

func (*Logger) Panicf

func (l *Logger) Panicf(format string, v ...interface{})

func (*Logger) Prefix

func (l *Logger) Prefix() string

func (*Logger) Print

func (l *Logger) Print(v ...interface{})

func (*Logger) Printf

func (l *Logger) Printf(format string, v ...interface{})

func (*Logger) Println

func (l *Logger) Println(v ...interface{})

func (*Logger) SetFlags

func (l *Logger) SetFlags(flags int)

func (*Logger) SetLevel

func (l *Logger) SetLevel(v LogLevel)

func (*Logger) SetLevelString

func (l *Logger) SetLevelString(s string) bool

func (*Logger) SetPrefix

func (l *Logger) SetPrefix(prefix string)

func (*Logger) SetTraceLevel

func (l *Logger) SetTraceLevel(v LogLevel)

func (*Logger) Warn

func (l *Logger) Warn(v ...interface{})

func (*Logger) WarnError

func (l *Logger) WarnError(err error, v ...interface{})

func (*Logger) WarnErrorf

func (l *Logger) WarnErrorf(err error, format string, v ...interface{})

func (*Logger) Warnf

func (l *Logger) Warnf(format string, v ...interface{})

type RollingFormat

type RollingFormat string

Jump to

Keyboard shortcuts

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