Documentation ¶
Index ¶
- Constants
- Variables
- func ExitLogger()
- func InitLogger(appName, fileName string)
- func PrinfInterface(v interface{})
- func PrintDebug(format string, v ...interface{})
- func PrintDebugCalldepth(calldepth int, format string, v ...interface{})
- func PrintError(format string, v ...interface{})
- func PrintErrorCalldepth(calldepth int, format string, v ...interface{})
- func PrintInfo(format string, v ...interface{})
- func PrintInfoCalldepth(calldepth int, format string, v ...interface{})
- func PrintLog(level logrus.Level, format string, v ...interface{})
- func PrintPanic(format string, v ...interface{})
- func PrintReport(callerName, calleeName, calleeNode, methods string, errCode int, ...)
- func PrintReportByTime(callerName, calleeName, calleeNode, methods string, errCode int, ...)
- func PrintZipkin(s string)
- type LogrusConfig
- type MyLogger
Constants ¶
View Source
const ( PanicLevel = logrus.PanicLevel // 打印后抛出异常 FatalLevel = logrus.FatalLevel ErrorLevel = logrus.ErrorLevel WarnLevel = logrus.WarnLevel InfoLevel = logrus.InfoLevel DebugLevel = logrus.DebugLevel TraceLevel = logrus.TraceLevel )
Variables ¶
View Source
var ( Black = "\033[30;1m" Red = "\033[31;1m" Green = "\033[32;1m" Yellow = "\033[33;1m" Blue = "\033[34;1m" Purple = "\033[35;1m" DarkGreen = "\033[36;1m" White = "\033[37;1m" Reset = "\033[0m" )
使用后要用Reset重置
Functions ¶
func ExitLogger ¶
func ExitLogger()
func PrintDebugCalldepth ¶
func PrintErrorCalldepth ¶
func PrintInfoCalldepth ¶
func PrintReport ¶
func PrintReport(callerName, calleeName, calleeNode, methods string, errCode int, timeConsume float64)
打印 Report 日志
func PrintReportByTime ¶
func PrintReportByTime(callerName, calleeName, calleeNode, methods string, errCode int, startTimeNano int64)
打印 Report 日志
Types ¶
type LogrusConfig ¶
type LogrusConfig struct { ProgramName string // 应用名,用于日志目录 LogFileName string // 日志文件名 LogFilePath string // 日志文件路径 Suffix string // 日志后缀 LogLevel logrus.Level // 日志打印级别 IsFormat bool // 是否格式化输出 PrLogMaxLen int // 打印日志最大长度 MaxSize int64 // 日志文件最大长度 MaxDays int // 日志文件保存天数 // contains filtered or unexported fields }
type MyLogger ¶
func NewLogrus ¶
func NewLogrus(logConf LogrusConfig) *MyLogger
func (*MyLogger) GetContextInfo ¶
获取日志打印内容的文件信息
Click to show internal directories.
Click to hide internal directories.