log

package
v1.17.0 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2024 License: LGPL-3.0 Imports: 14 Imported by: 327

Documentation

Index

Constants

View Source
const (
	Blue   = "0;34"
	Red    = "0;31"
	Green  = "0;32"
	Yellow = "0;33"
	Cyan   = "0;36"
	Pink   = "1;35"
)
View Source
const (
	TraceLog = iota
	DebugLog
	InfoLog
	WarnLog
	ErrorLog
	FatalLog
	MaxLevelLog
)
View Source
const (
	NAME_PREFIX          = "LEVEL"
	CALL_DEPTH           = 2
	DEFAULT_MAX_LOG_SIZE = 20
	BYTE_TO_MB           = 1024 * 1024
)

Variables

View Source
var (
	Stdout = os.Stdout
	PATH   = "./Log/"
)
View Source
var Test = Fatal

used for develop stage and not allowed in production enforced by CI

View Source
var Testf = Fatalf

Functions

func CheckRotateLogFile added in v1.12.0

func CheckRotateLogFile()

func ClosePrintLog

func ClosePrintLog() error

func Color

func Color(code, msg string) string

func Debug

func Debug(a ...interface{})

func Debugf

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

func Error

func Error(a ...interface{})

func Errorf

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

func Fatal

func Fatal(a ...interface{})

func Fatalf

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

func FileOpen

func FileOpen(path string) (*os.File, error)

func GetGID

func GetGID() uint64

func GetLogFileSize

func GetLogFileSize() (int64, error)

func GetMaxLogChangeInterval

func GetMaxLogChangeInterval(maxLogSize int64) int64

func Info

func Info(a ...interface{})

func Infof

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

func Init

func Init(a ...interface{})

Init deprecated, use InitLog instead

func InitLog

func InitLog(logLevel int, a ...interface{})

func LevelName

func LevelName(level int) string

func Trace

func Trace(a ...interface{})

func Tracef

func Tracef(format string, a ...interface{})

func Warn

func Warn(a ...interface{})

func Warnf

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

Types

type Logger

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

func Log

func Log() *Logger

func New

func New(out io.Writer, prefix string, flag, level int, file *os.File) *Logger

func (*Logger) Debug

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

func (*Logger) Debugf

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

func (*Logger) Error

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

func (*Logger) Errorf

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

func (*Logger) Fatal

func (l *Logger) Fatal(a ...interface{})

func (*Logger) Fatalf

func (l *Logger) Fatalf(format string, a ...interface{})

func (*Logger) Info

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

func (*Logger) Infof

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

func (*Logger) Output

func (l *Logger) Output(level int, a ...interface{}) error

func (*Logger) Outputf

func (l *Logger) Outputf(level int, format string, v ...interface{}) error

func (*Logger) SetDebugLevel

func (l *Logger) SetDebugLevel(level int) error

func (*Logger) Trace

func (l *Logger) Trace(a ...interface{})

func (*Logger) Tracef

func (l *Logger) Tracef(format string, a ...interface{})

func (*Logger) Warn

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

func (*Logger) Warnf

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

Jump to

Keyboard shortcuts

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