Documentation ¶
Index ¶
- Constants
- Variables
- func GetCaller(calldepth int) (str string)
- func GetLogTextPrefix(calldepth int, format string) string
- func GetNowTime(format string) (str string)
- func GetNowUnixTimeOBJ() time.Time
- func Itoa(i int, wid int) string
- type AlertApiConfig
- type ConfigOption
- func WithAlertOPT(appId, URL, ContentType string) ConfigOption
- func WithCommonOPT(cDep int, dateFormat string) ConfigOption
- func WithConsoleOPT() ConfigOption
- func WithFileOPT(filepath, filename, filesuffix string, fileMaxSize int64, fileMaxNSize int) ConfigOption
- func WithcallDepOPT(cDep int) ConfigOption
- type LoggerInterface
Constants ¶
View Source
const ( DEFAULTFILENAME = "info" //默认文件前缀 DEFAULTFILEPATH = "./" //默认文件存放路径 DEFAULTFILESUFFIX = "log" //默认文件后缀 DEFAULTFILEMAXSIZE = 2 << 29 //默认单个文件最大1G )
默认值
View Source
const ( ALL uint8 = iota DEBUG INFO WARN ERROR FATAL ALERT OFF )
View Source
const ( ALERTALERT = "notice" // notice ALERTWARNING = "warning" // 严重 ALERTCRITICAL = "critical" // 紧急 )
alert level
View Source
const ( DIAGONAL = "/" COLON = ":" BLANK = " " NEWLINE = "\n" DOT = "." UNDERSCODE = "_" DASH = "-" )
View Source
const ( TYPEDEBUG = "DEBUG" TYPEINFO = "INFO" TYPEWARN = "WARN" TYPEERROR = "ERROR" TYPEFATAL = "FATAL" TYPEALERT = "ALERT" )
View Source
const ( COLOR_RED = uint8(iota + 91) COLOR_GREEN COLOR_YELLOW COLOR_BLUE COLOR_MAGENTA //洋红 COLOR_INTENSITY )
View Source
const COLOR_TPL = "\x1b[%dm%s\x1b[0m"
Variables ¶
View Source
var ( YRDLogger LoggerInterface ServerIp string TimeLocation *time.Location )
Functions ¶
func GetLogTextPrefix ¶
func GetNowTime ¶
func GetNowUnixTimeOBJ ¶
Types ¶
type AlertApiConfig ¶
type ConfigOption ¶
type ConfigOption func(*logger)
func WithCommonOPT ¶
func WithCommonOPT(cDep int, dateFormat string) ConfigOption
func WithConsoleOPT ¶
func WithConsoleOPT() ConfigOption
func WithFileOPT ¶
func WithFileOPT(filepath, filename, filesuffix string, fileMaxSize int64, fileMaxNSize int) ConfigOption
func WithcallDepOPT ¶
func WithcallDepOPT(cDep int) ConfigOption
type LoggerInterface ¶
type LoggerInterface interface { SetConfig(uint8, string, ...ConfigOption) SetTextPrefix(...interface{}) AddTextPrefix(...interface{}) Debug(v ...interface{}) Info(v ...interface{}) Warn(v ...interface{}) Error(v ...interface{}) Fatal(v ...interface{}) AlertWithLevel(alertLevel string, v ...interface{}) }
func GetLogger ¶
func GetLogger() LoggerInterface
Click to show internal directories.
Click to hide internal directories.