log

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Default = iota
	Black
	DarkGray
	Red
	Green
	Yellow
	Blue
	Purple
	Cyan
	White
	BoldPurple
	BoldRed
	BoldGreen
)

Variables

View Source
var LOGLEVELSTR = []string{"INFO", "DEBUG"}
View Source
var NOWLOGLEVEL = INFO

Functions

func ColorTxt

func ColorTxt(color int, str string) string

预设颜色代码

func ColorTxtForCode

func ColorTxtForCode(color string, str string) string

自定义颜色代码

func LogInit

func LogInit(logLevel LOGLEVEL, isOutFile bool, isColorConsole int, outPath string)

日志初始化

func Print

func Print(LOGLEVEL LOGLEVEL, logText ...interface{})

打印日志

Types

type LOGLEVEL

type LOGLEVEL int
const (
	INFO LOGLEVEL = iota
	DEBUG
)

func StringToLOGLEVEL

func StringToLOGLEVEL(str string) LOGLEVEL

通过字符串返回对应枚举值

func (LOGLEVEL) Index

func (level LOGLEVEL) Index() int

返回枚举项的字符值

func (LOGLEVEL) String

func (level LOGLEVEL) String() string

返回枚举项的索引值

type TxT

type TxT struct {
	Txt   string //文字
	Color int    //颜色对应枚举
}

Jump to

Keyboard shortcuts

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