log

package
v0.0.0-...-bd81c7d Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LogLevelError = 1 << iota
	LogLevelWarn
	LogLevelInfo
	LogLevelDebug
)
View Source
const PrefixHeadLen = 48

Variables

View Source
var (
	Reset = string([]byte{27, 91, 48, 109})
)

Functions

func ColorForMethod

func ColorForMethod(method string) string

func ColorForReset

func ColorForReset() string

func ColorForStatus

func ColorForStatus(code int) string

func Debug

func Debug(v ...interface{})

func DebugF

func DebugF(format string, args ...interface{})

func Error

func Error(v ...interface{})

func ErrorF

func ErrorF(format string, args ...interface{})

func Info

func Info(v ...interface{})

func InfoF

func InfoF(format string, args ...interface{})

func Warn

func Warn(v ...interface{})

func WarnF

func WarnF(format string, args ...interface{})

Types

type ComLog

type ComLog struct {
	LogLevel       int
	LastRotateTime time.Time
	LogMaxSize     int
	LogCurSize     int
	FileFullName   string
	PFile          *os.File
	Log            *log.Logger
	M              sync.Mutex
}
var GLog *ComLog

func InitLog

func InitLog(logDir string, logFile string, logStrLevel string, LogMaxSize int) (*ComLog, error)

func (*ComLog) Debug

func (cLog *ComLog) Debug(v ...interface{})

func (*ComLog) DebugF

func (cLog *ComLog) DebugF(format string, args ...interface{})

func (*ComLog) Error

func (cLog *ComLog) Error(v ...interface{})

func (*ComLog) ErrorF

func (cLog *ComLog) ErrorF(format string, args ...interface{})

func (*ComLog) Info

func (cLog *ComLog) Info(v ...interface{})

func (*ComLog) InfoF

func (cLog *ComLog) InfoF(format string, args ...interface{})

func (*ComLog) Warn

func (cLog *ComLog) Warn(v ...interface{})

func (*ComLog) WarnF

func (cLog *ComLog) WarnF(format string, args ...interface{})

type DailyLog

type DailyLog struct {
	LastCheckTime time.Time
	LogLevel      int
	LogCurSize    int
	FileFullName  string
	PFile         *os.File
	Log           *log.Logger
	M             sync.Mutex
}
var GDailyLog *DailyLog

func InitDailyLog

func InitDailyLog(logDir string, logFile string, logStrLevel string) (*DailyLog, error)

func (*DailyLog) Debug

func (dLog *DailyLog) Debug(v ...interface{})

func (*DailyLog) DebugF

func (dLog *DailyLog) DebugF(format string, args ...interface{})

func (*DailyLog) Error

func (dLog *DailyLog) Error(v ...interface{})

func (*DailyLog) ErrorF

func (dLog *DailyLog) ErrorF(format string, args ...interface{})

func (*DailyLog) Info

func (dLog *DailyLog) Info(v ...interface{})

func (*DailyLog) InfoF

func (dLog *DailyLog) InfoF(format string, args ...interface{})

func (*DailyLog) Warn

func (dLog *DailyLog) Warn(v ...interface{})

func (*DailyLog) WarnF

func (dLog *DailyLog) WarnF(format string, args ...interface{})

type SizeLog

type SizeLog struct {
	LogLevel     int
	LogMaxSize   int
	LogCurSize   int
	FileFullName string
	PFile        *os.File
	Log          *log.Logger
	M            sync.Mutex
}
var GSizeLog *SizeLog

func InitSizeLog

func InitSizeLog(logDir string, logFile string, logStrLevel string, LogMaxSize int) (*SizeLog, error)

func (*SizeLog) Debug

func (slog *SizeLog) Debug(v ...interface{})

func (*SizeLog) DebugF

func (slog *SizeLog) DebugF(format string, args ...interface{})

func (*SizeLog) Error

func (slog *SizeLog) Error(v ...interface{})

func (*SizeLog) ErrorF

func (slog *SizeLog) ErrorF(format string, args ...interface{})

func (*SizeLog) Info

func (slog *SizeLog) Info(v ...interface{})

func (*SizeLog) InfoF

func (slog *SizeLog) InfoF(format string, args ...interface{})

func (*SizeLog) Warn

func (slog *SizeLog) Warn(v ...interface{})

func (*SizeLog) WarnF

func (slog *SizeLog) WarnF(format string, args ...interface{})

Jump to

Keyboard shortcuts

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