log

package module
v0.0.0-...-84b4cc3 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DebugLevel = iota
	InfoLevel
	WarnLevel
	ErrorLevel
	FatalLevel
)
View Source
const (
	KB
	MB
	GB
	TB
	PB
)

Variables

View Source
var (
	ErrProcessExist = errors.New("same process is exists")
	ErrExit         = errors.New("process will exit")
)

Functions

func Compress

func Compress(filename string, suffix string, del bool) error

func CreatePidFile

func CreatePidFile(path string) error

CreatePidFile return err when other process is exist or other error ref https://github.com/tabalt/pidfile

func FileExists

func FileExists(name string) (os.FileInfo, bool)

file exists

func Glob

func Glob(dir, pattern string, beforeTime time.Time) ([]string, error)

glob searches for files in dir, matching pattern and before time exclude dirs in dir

func ProcessExist

func ProcessExist(pid int) bool

func ProfileMEM

func ProfileMEM(name string) error

func ReadPidFromFile

func ReadPidFromFile(path string) (int, error)

func StartProfileCPU

func StartProfileCPU(name string) (*os.File, error)

go tool pprof cpu.cprof

func StopProfileCPU

func StopProfileCPU(fd *os.File)

Types

type Logger

type Logger interface {
	SetLogger(handlerType string, config map[string]interface{}) error
	SetLevel(level int)
	Debug(format string, v ...interface{})
	Info(format string, v ...interface{})
	Warn(format string, v ...interface{})
	Error(format string, v ...interface{})
	Fatal(format string, v ...interface{})
}

no need add newline after msg

func NewLogger

func NewLogger() Logger

type LoggerImp

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

func (*LoggerImp) Debug

func (l *LoggerImp) Debug(format string, v ...interface{})

func (*LoggerImp) Error

func (l *LoggerImp) Error(format string, v ...interface{})

func (*LoggerImp) Fatal

func (l *LoggerImp) Fatal(format string, v ...interface{})

func (*LoggerImp) Info

func (l *LoggerImp) Info(format string, v ...interface{})

func (*LoggerImp) SetLevel

func (l *LoggerImp) SetLevel(level int)

func (*LoggerImp) SetLogger

func (l *LoggerImp) SetLogger(handlerType string, config map[string]interface{}) error

func (*LoggerImp) Warn

func (l *LoggerImp) Warn(format string, v ...interface{})

Jump to

Keyboard shortcuts

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