rlog

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2023 License: MIT Imports: 14 Imported by: 1

Documentation

Index

Constants

View Source
const (
	LevelDebug = iota
	LevelInfo
	LevelSuccess
	LevelWarn
	LevelError
	LevelPanic
	LevelDisable = 100
)
View Source
const (
	LogFileModel          = 0660
	DefaultLogFileMaxSize = 1024 * 1024 * 10
)

Variables

This section is empty.

Functions

func Debug

func Debug(a ...any)

func Error

func Error(a ...any)

func Info

func Info(a ...any)

func Init added in v1.1.0

func Init()

Init 初始化,需要在 main函数或者main.init里调用。 用于计算出项目文件夹地址。

func Panic

func Panic(a ...any)

func Print added in v1.1.0

func Print(a ...any)

func Printf added in v1.1.0

func Printf(format string, a ...any)

func Println added in v1.1.0

func Println(a ...any)

func PrintlnConsoleMust added in v1.1.0

func PrintlnConsoleMust(a ...any)

PrintlnConsoleMust 强制打印到控制台日志

func PrintlnConsoleMustOnly added in v1.1.0

func PrintlnConsoleMustOnly(a ...any)

PrintlnConsoleMustOnly 强制只打印到控制台日志

func PrintlnFileMust added in v1.1.0

func PrintlnFileMust(a ...any)

PrintlnFileMust 强制打印到文件

func PrintlnFileMustOnly added in v1.1.0

func PrintlnFileMustOnly(a ...any)

PrintlnFileMustOnly 强制只打印到文件

func ProjectDir added in v1.1.0

func ProjectDir() string

ProjectDir 返回项目main函数的文件夹地址

func SetAutoDeleteOldLogFile added in v1.1.0

func SetAutoDeleteOldLogFile(day uint)

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

func SetConsoleLevel added in v1.1.0

func SetConsoleLevel(level Level)

SetConsoleLevel 设置控制台日志打印等级

func SetFileLevel added in v1.1.0

func SetFileLevel(level Level)

SetFileLevel 设置文件日志打印等级

func SetFullTextStaining added in v1.1.0

func SetFullTextStaining(full bool)

SetFullTextStaining 设置是否全文着色,默认false:tag 着色。

func SetLogFileMaxSize added in v1.1.0

func SetLogFileMaxSize(mb uint)

SetLogFileMaxSize 设置日志文件最大大小,MB

func SetLogFilePath

func SetLogFilePath(filepath string, oldLogToZip bool)

SetLogFilePath 设置日志文件路径

func Success added in v1.1.0

func Success(a ...any)

func WaitFinish added in v1.1.0

func WaitFinish()

WaitFinish 安全结束日志打印

func Warn

func Warn(a ...any)

Types

type Level added in v1.1.0

type Level byte

type RLogger added in v1.1.0

type RLogger interface {
	Print(a ...any)
	Println(a ...any)
	Printf(format string, a ...any)

	Debug(a ...any)
	Info(a ...any)
	Success(a ...any)
	Warn(a ...any)
	Error(a ...any)
	Panic(a ...any)

	PrintlnConsoleMust(a ...any)     //强制打印到控制台日志
	PrintlnFileMust(a ...any)        //强制打印到文件
	PrintlnConsoleMustOnly(a ...any) //强制只打印到控制台日志
	PrintlnFileMustOnly(a ...any)    //强制只打印到文件

	SetLogFilePath(filepath string, oldLogToZip bool) //设置日志文件路径
	SetConsoleLevel(level Level)                      //设置控制台日志打印等级
	SetFileLevel(level Level)                         //设置文件日志打印等级
	SetFullTextStaining(full bool)                    //设置是否全文着色,默认false:tag 着色。
	SetAutoDeleteOldLogFile(day uint)                 //设置自动删除多少天前的日志
	SetLogFileMaxSize(mb uint)                        //设置日志文件最大大小,MB
	// contains filtered or unexported methods
}

func NewLogger added in v1.1.0

func NewLogger(stdout io.Writer) RLogger

NewLogger 新建一个日志管理器 windows彩色日志:import "github.com/mattn/go-colorable" 参数传 colorable.NewColorableStdout()

Jump to

Keyboard shortcuts

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