Apply .gitignore rules
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
package impl_console
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/fatih/color"
|
||||
)
|
||||
|
||||
type Logger struct {
|
||||
}
|
||||
|
||||
// NewLogger
|
||||
// @description: 构造控制台日志
|
||||
// parameter:
|
||||
// return:
|
||||
// @*Logger:
|
||||
func NewLogger() *Logger {
|
||||
return &Logger{}
|
||||
}
|
||||
|
||||
// InfoLog
|
||||
// @description: 信息日志记录
|
||||
// parameter:
|
||||
// @format:日志格式
|
||||
// @args:参数列表
|
||||
// return:
|
||||
func (cl *Logger) InfoLog(format string, args ...interface{}) {
|
||||
c := color.New(color.FgGreen)
|
||||
s := c.Sprint("Info:")
|
||||
fmt.Println(s, fmt.Sprintf(format, args...))
|
||||
}
|
||||
|
||||
// DebugLog
|
||||
// @description: 调试日志记录
|
||||
// parameter:
|
||||
// @format:日志格式
|
||||
// @args:参数列表
|
||||
// return:
|
||||
func (cl *Logger) DebugLog(format string, args ...interface{}) {
|
||||
c := color.New(color.FgGreen)
|
||||
s := c.Sprint("Debug:")
|
||||
fmt.Println(s, fmt.Sprintf(format, args...))
|
||||
}
|
||||
|
||||
// WarnLog
|
||||
// @description: 警告日志记录
|
||||
// parameter:
|
||||
// @format:日志格式
|
||||
// @args:参数列表
|
||||
// return:
|
||||
func (cl *Logger) WarnLog(format string, args ...interface{}) {
|
||||
c := color.New(color.FgYellow)
|
||||
_, _ = c.Println("Warn:", fmt.Sprintf(format, args...))
|
||||
}
|
||||
|
||||
// ErrorLog
|
||||
// @description: 错误日志记录
|
||||
// parameter:
|
||||
// @format:日志格式
|
||||
// @args:参数列表
|
||||
// return:
|
||||
func (cl *Logger) ErrorLog(format string, args ...interface{}) {
|
||||
c := color.New(color.FgRed)
|
||||
_, _ = c.Println("Error:", fmt.Sprintf(format, args...))
|
||||
}
|
||||
|
||||
// FatalLog
|
||||
// @description: 致命错误日志记录
|
||||
// parameter:
|
||||
// @format:日志格式
|
||||
// @args:参数列表
|
||||
// return:
|
||||
func (cl *Logger) FatalLog(format string, args ...interface{}) {
|
||||
c := color.New(color.FgRed)
|
||||
_, _ = c.Println("Fatal:", fmt.Sprintf(format, args...))
|
||||
}
|
||||
|
||||
// CloseLog
|
||||
// @description: 关闭日志
|
||||
// parameter:
|
||||
// @waitFinish:是否等待日志
|
||||
// return:
|
||||
func (cl *Logger) CloseLog(waitFinish bool) {
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user