rlog

package
v0.0.18 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModelNoPath      PrintModel = 1 //不打印代码文件路径及行号
	ModelNoTime      PrintModel = 2 //不打印日期、时间、时区
	ModelNoPathTime  PrintModel = 3 //不打印代码文件路径及行号、不打印日期、时间、时区
	ModelMustConsole PrintModel = 4 //必须打印控制台日志
	ModelNoConsole   PrintModel = 5 //不打印到控制台
	ModelMustFile    PrintModel = 6 //必须打印到文件日志
	ModelNoFile      PrintModel = 7 //不打印到文件
	ModelMustAll     PrintModel = 8 //必须打印到控制台日志和文件日志

	LogLevelDebug    LogLeve = 0 //日志等级debug,该等级打印所有级别的日志
	LogLevelInfo     LogLeve = 1 //日志等级info,该等级仅不打印debug日志
	LogLeveSuccess   LogLeve = 2 //日志等级success,该等级仅不打印debug,info日志
	LogLevelWarn     LogLeve = 3 //日志等级warn,该等级仅不打印debug,info,success日志
	LogLevelError    LogLeve = 4 //日志等级Error,该等级仅不打印debug,info,success,warn日志
	LogLevelPanic    LogLeve = 5 //日志等级Panic,该等级仅不打印debug,info,success,warn,error日志
	LogLevelNotPrint LogLeve = 6 //日志等级最高,该等级不打印任何日志

	// TimeFormatDefault 输出日志,前面时间的格式
	TimeFormatDefault   LogTimeFormat = `2006/01/02·15:04:05.000-0700 `
	TimeFormatYMDHMSmsZ LogTimeFormat = `2006/01/02·15:04:05.000-0700 `
	TimeFormatYMDHMSZ   LogTimeFormat = `2006/01/02·15:04:05-0700 `
	TimeFormatYMDHMS    LogTimeFormat = `2006/01/02·15:04:05 `
	TimeFormatYMDHMSms  LogTimeFormat = `2006/01/02·15:04:05.000 `
	TimeFormatMDHMSmsZ  LogTimeFormat = `01/02·15:04:05.000-0700 `
	TimeFormatMDHMSZ    LogTimeFormat = `01/02·15:04:05-0700 `
	TimeFormatMDHMS     LogTimeFormat = `01/02·15:04:05 `
	TimeFormatMDHMSms   LogTimeFormat = `01/02·15:04:05.000 `
	TimeFormatHMSmsZ    LogTimeFormat = `15:04:05.000-0700 `
	TimeFormatHMSZ      LogTimeFormat = `15:04:05-0700 `
	TimeFormatHMS       LogTimeFormat = `15:04:05 `
	TimeFormatHMSms     LogTimeFormat = `15:04:05.000 `
)

Variables

This section is empty.

Functions

func Debug

func Debug(v ...any)

func DebugP added in v0.0.5

func DebugP(model PrintModel, v ...any)

func Error

func Error(v ...any)

func ErrorP added in v0.0.5

func ErrorP(model PrintModel, v ...any)

func GetCropPathLength added in v0.0.5

func GetCropPathLength() uint

GetCropPathLength 获取项目文件夹路径字符长度

func Info

func Info(v ...any)

func InfoP added in v0.0.5

func InfoP(model PrintModel, v ...any)

func Panic

func Panic(v ...any)

func PanicP added in v0.0.5

func PanicP(model PrintModel, v ...any)

func SetAutoRemoveLogFile

func SetAutoRemoveLogFile(day uint)

SetAutoRemoveLogFile 设置自动删除多少天以前的日志

func SetCropPathLength added in v0.0.5

func SetCropPathLength(length int)

SetCropPathLength 设置去除日志代码文件路径前面多少个字符

func SetLogFile added in v0.0.5

func SetLogFile(logDir string, fileMaxSize int64, isOneFile bool)

SetLogFile 设置日志文件路径

func SetLogLevel added in v0.0.5

func SetLogLevel(Console LogLeve, File LogLeve)

SetLogLevel 设置基本配置信息 Console:打印到控制台的日志等级 File:打印到文件的日志等级

func SetLogTimeFormat added in v0.0.16

func SetLogTimeFormat(format LogTimeFormat)

SetLogTimeFormat 设置输出日志,前面时间的格式

func SetPrintCodeFilePath added in v0.0.5

func SetPrintCodeFilePath(printCode bool)

SetPrintCodeFilePath 设置是否打印代码文件路径,默认打印

func Success added in v0.0.5

func Success(v ...any)

func SuccessP added in v0.0.5

func SuccessP(model PrintModel, v ...any)

func WaitFinish added in v0.0.5

func WaitFinish()

WaitFinish 等待完成,一般用于程序终止前,打印完所有日志再结束程序。

func Warn

func Warn(v ...any)

func WarnP added in v0.0.5

func WarnP(model PrintModel, v ...any)

Types

type LogLeve added in v0.0.5

type LogLeve uint8

type LogTimeFormat added in v0.0.16

type LogTimeFormat string

type PrintModel added in v0.0.5

type PrintModel uint8

Jump to

Keyboard shortcuts

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