clog

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

README

clog

多级别的日志打印

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close()

Close 关闭文件日志输出

func Complete

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

Complete 任务完成信息,蓝色

func Debug

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

Debug 调试信息, 灰色

func ErrInfo

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

ErrInfo 不太重要的错误信息,黄色

func Error

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

Error 严重错误,红色

func Export

func Export(logger *Logger)

Export It's dangerous to call the method on logging

func Fail

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

Fail 失败信息,浅红色

func Fatal

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

Fatal 致命错误, 白色

func Info

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

Info 基本信息,紫色

func Start

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

Start 任务开始信息,青色

func Success

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

Success 成功信息,绿色

Types

type Level

type Level int

Level 日志等级

const (
	DebugLevel           Level = iota //调试
	ReleaseInfoLevel                  //信息
	ReleaseStartLevel                 //开始
	ReleaseCompleteLevel              //完成
	ReleaseSuccessLevel               //成功
	ReleaseErrInfoLevel               //错误信息
	ReleaseFailLevel                  //失败
	ErrorLevel                        //严重错误
	FatalLevel                        //致命错误,程序终止
)

func NewLevel added in v1.0.1

func NewLevel(v int) Level

NewLevel 从Int值获取等级

func (Level) ColorPrinter

func (l Level) ColorPrinter() color.PrinterFace

func (Level) Prefix

func (l Level) Prefix() string

func (Level) Value

func (l Level) Value() int

type LogExt

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

func NewLogExt

func NewLogExt(title string) *LogExt

func (*LogExt) Completion

func (l *LogExt) Completion(err error)

func (*LogExt) Fail

func (l *LogExt) Fail(err error)

func (*LogExt) Final

func (l *LogExt) Final()

func (*LogExt) Start

func (l *LogExt) Start()

type Logger

type Logger struct {
	sync.Mutex

	//打印到文件时是否打印到控制台, true-不打印, false打印
	ConsoleNotPrintWhenHasFile bool
	// contains filtered or unexported fields
}

func New

func New(level Level, logDir string, logFlag int) (*Logger, error)

func (*Logger) Close

func (l *Logger) Close()

Close It's dangerous to call the method on logging

func (*Logger) DoPrintf

func (l *Logger) DoPrintf(printLevel Level, format string, a ...interface{})

func (*Logger) SetLoggerFlag added in v1.0.1

func (l *Logger) SetLoggerFlag(flag int)

SetLoggerFlag 设置Logger的Flag

Jump to

Keyboard shortcuts

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