logHelper

package
v0.0.0-...-a1f72da Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2023 License: MulanPSL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Console = NewConsoleHandler()

Functions

func Close

func Close()

func Debug

func Debug(v ...interface{})

func Error

func Error(v ...interface{})

func Fatal

func Fatal(v ...interface{})

func Fatalf

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

func Fatalln

func Fatalln(v ...interface{})

func Info

func Info(v ...interface{})

func InitAppLogger

func InitAppLogger()

func Panic

func Panic(v ...interface{})

func Panicf

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

func Panicln

func Panicln(v ...interface{})

func Print

func Print(v ...interface{})

func Printf

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

func Println

func Println(v ...interface{})

func SetFlags

func SetFlags(flag int)

func SetHandlers

func SetHandlers(handlers ...Handler)

func SetLevel

func SetLevel(level Level)

func ToStackError

func ToStackError(err error) string

func Warn

func Warn(v ...interface{})

Types

type ConsoleHander

type ConsoleHander struct {
	LogHandler
}

func NewConsoleHandler

func NewConsoleHandler() *ConsoleHander

type FileHandler

type FileHandler struct {
	LogHandler
	// contains filtered or unexported fields
}

func NewFileHandler

func NewFileHandler(filepath string) *FileHandler

type Handler

type Handler interface {
	SetOutput(w io.Writer)
	Output(calldepth int, s string) error
	Printf(format string, v ...interface{})
	Print(v ...interface{})
	Println(v ...interface{})
	Fatal(v ...interface{})
	Fatalf(format string, v ...interface{})
	Fatalln(v ...interface{})

	Debug(v ...interface{})
	Info(v ...interface{})
	Warn(v ...interface{})
	Error(v ...interface{})

	Flags() int
	SetFlags(flag int)
	Prefix() string
	SetPrefix(prefix string)
	// contains filtered or unexported methods
}

=================== log handlers ===================

type Level

type Level int32
const (
	DEBUG Level = iota
	INFO
	WARN
	ERROR
)

type LogHandler

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

func (*LogHandler) Debug

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

func (*LogHandler) Error

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

func (*LogHandler) Fatal

func (l *LogHandler) Fatal(v ...interface{})

func (*LogHandler) Fatalf

func (l *LogHandler) Fatalf(format string, v ...interface{})

func (*LogHandler) Fatalln

func (l *LogHandler) Fatalln(v ...interface{})

func (*LogHandler) Flags

func (l *LogHandler) Flags() int

func (*LogHandler) Info

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

func (*LogHandler) Output

func (l *LogHandler) Output(calldepth int, s string) error

func (*LogHandler) Prefix

func (l *LogHandler) Prefix() string

func (*LogHandler) Print

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

func (*LogHandler) Printf

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

func (*LogHandler) Println

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

func (*LogHandler) SetFlags

func (l *LogHandler) SetFlags(flag int)

func (*LogHandler) SetOutput

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

func (*LogHandler) SetPrefix

func (l *LogHandler) SetPrefix(prefix string)

func (*LogHandler) Warn

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

type RotatingHandler

type RotatingHandler struct {
	LogHandler
	// contains filtered or unexported fields
}

func NewRotatingHandler

func NewRotatingHandler(dir string, filename string, maxNum int, maxSize int64) *RotatingHandler

Jump to

Keyboard shortcuts

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