Documentation ¶
Index ¶
- Constants
- Variables
- func AddFlag(flag int)
- func CleanFastLog(log *FastLoggerCore)
- func Debug(v ...interface{})
- func DebugF(format string, v ...interface{})
- func Error(v ...interface{})
- func ErrorF(format string, v ...interface{})
- func Fatal(v ...interface{})
- func FatalF(format string, v ...interface{})
- func Flags() int
- func Info(v ...interface{})
- func InfoF(format string, v ...interface{})
- func Panic(v ...interface{})
- func PanicF(format string, v ...interface{})
- func ResetFlags(flag int)
- func SetCons(b bool)
- func SetLogFile(fileDir string, fileName string)
- func SetLogLevel(logLevel int)
- func SetLogger(logger ILogger)
- func SetMaxAge(ma int)
- func SetMaxSize(ms int64)
- func SetPrefix(prefix string)
- func Stack(v ...interface{})
- func Warn(v ...interface{})
- func WarnF(format string, v ...interface{})
- type FastLoggerCore
- func (log *FastLoggerCore) AddFlag(flag int)
- func (log *FastLoggerCore) Debug(v ...interface{})
- func (log *FastLoggerCore) DebugF(format string, v ...interface{})
- func (log *FastLoggerCore) Error(v ...interface{})
- func (log *FastLoggerCore) ErrorF(format string, v ...interface{})
- func (log *FastLoggerCore) Fatal(v ...interface{})
- func (log *FastLoggerCore) FatalF(format string, v ...interface{})
- func (log *FastLoggerCore) Flags() int
- func (log *FastLoggerCore) Info(v ...interface{})
- func (log *FastLoggerCore) InfoF(format string, v ...interface{})
- func (log *FastLoggerCore) OutPut(level int, s string) error
- func (log *FastLoggerCore) Panic(v ...interface{})
- func (log *FastLoggerCore) PanicF(format string, v ...interface{})
- func (log *FastLoggerCore) ResetFlags(flag int)
- func (log *FastLoggerCore) SetConsole(b bool)
- func (log *FastLoggerCore) SetLogFile(fileDir string, fileName string)
- func (log *FastLoggerCore) SetLogHook(f func([]byte))
- func (log *FastLoggerCore) SetLogLevel(logLevel int)
- func (log *FastLoggerCore) SetMaxAge(ma int)
- func (log *FastLoggerCore) SetMaxSize(ms int64)
- func (log *FastLoggerCore) SetPrefix(prefix string)
- func (log *FastLoggerCore) Stack(v ...interface{})
- func (log *FastLoggerCore) Warn(v ...interface{})
- func (log *FastLoggerCore) WarnF(format string, v ...interface{})
- type ILogger
Constants ¶
View Source
const ( BitDate = 1 << iota // Date flag bit 2019/01/23 (日期标记位) BitTime // Time flag bit 01:23:12 (时间标记位) BitMicroSeconds // Microsecond flag bit 01:23:12.111222 (微秒级标记位) BitLongFile // Complete file name /home/go/src/fastnet2/server.go (完整文件名称) BitShortFile // Last file name server.go (最后文件名) BitLevel // Current log level: 0(Debug), 1(Info), 2(Warn), 3(Error), 4(Panic), 5(Fatal) (当前日志级别) BitStdFlag = BitDate | BitTime // Standard log header format (标准头部日志格式) BitDefault = BitLevel | BitShortFile | BitStdFlag // Default log header format (默认日志头部格式) )
日志头部信息标记位,采用bitmap方式,用户可以选择头部需要哪些标记位被打印
View Source
const ( LogDebug = iota LogInfo LogWarn LogError LogPanic LogFatal )
Log Level
View Source
const (
LogMaxBuf = 1024 * 1024
)
Variables ¶
View Source
var StdFastLog = NewFastLog("", BitDefault)
StdFastLog creates a global log
Functions ¶
func SetLogFile ¶
SetLogFile sets the log file of StdFastLog
Types ¶
type FastLoggerCore ¶
type FastLoggerCore struct {
// contains filtered or unexported fields
}
func NewFastLog ¶
func NewFastLog(prefix string, flag int) *FastLoggerCore
func (*FastLoggerCore) Debug ¶
func (log *FastLoggerCore) Debug(v ...interface{})
func (*FastLoggerCore) DebugF ¶
func (log *FastLoggerCore) DebugF(format string, v ...interface{})
func (*FastLoggerCore) Error ¶
func (log *FastLoggerCore) Error(v ...interface{})
func (*FastLoggerCore) ErrorF ¶
func (log *FastLoggerCore) ErrorF(format string, v ...interface{})
func (*FastLoggerCore) Fatal ¶
func (log *FastLoggerCore) Fatal(v ...interface{})
func (*FastLoggerCore) FatalF ¶
func (log *FastLoggerCore) FatalF(format string, v ...interface{})
func (*FastLoggerCore) Info ¶
func (log *FastLoggerCore) Info(v ...interface{})
func (*FastLoggerCore) InfoF ¶
func (log *FastLoggerCore) InfoF(format string, v ...interface{})
func (*FastLoggerCore) OutPut ¶
func (log *FastLoggerCore) OutPut(level int, s string) error
OutPut outputs log file, the original method
func (*FastLoggerCore) Panic ¶
func (log *FastLoggerCore) Panic(v ...interface{})
func (*FastLoggerCore) PanicF ¶
func (log *FastLoggerCore) PanicF(format string, v ...interface{})
func (*FastLoggerCore) ResetFlags ¶
func (log *FastLoggerCore) ResetFlags(flag int)
ResetFlags 重新设置日志Flags bitMap 标记位
func (*FastLoggerCore) SetConsole ¶
func (log *FastLoggerCore) SetConsole(b bool)
SetConsole 同时输出控制台
func (*FastLoggerCore) SetLogFile ¶
func (log *FastLoggerCore) SetLogFile(fileDir string, fileName string)
SetLogFile 设置日志文件输出
func (*FastLoggerCore) SetLogHook ¶
func (log *FastLoggerCore) SetLogHook(f func([]byte))
func (*FastLoggerCore) SetLogLevel ¶
func (log *FastLoggerCore) SetLogLevel(logLevel int)
func (*FastLoggerCore) SetMaxSize ¶
func (log *FastLoggerCore) SetMaxSize(ms int64)
SetMaxSize 单个日志最大容量 单位:字节
func (*FastLoggerCore) SetPrefix ¶
func (log *FastLoggerCore) SetPrefix(prefix string)
SetPrefix 设置日志的 用户自定义前缀字符串
func (*FastLoggerCore) Stack ¶
func (log *FastLoggerCore) Stack(v ...interface{})
func (*FastLoggerCore) Warn ¶
func (log *FastLoggerCore) Warn(v ...interface{})
func (*FastLoggerCore) WarnF ¶
func (log *FastLoggerCore) WarnF(format string, v ...interface{})
type ILogger ¶ added in v1.0.2
type ILogger interface { InfoF(format string, v ...interface{}) ErrorF(format string, v ...interface{}) DebugF(format string, v ...interface{}) InfoFX(ctx context.Context, format string, v ...interface{}) ErrorFX(ctx context.Context, format string, v ...interface{}) DebugFX(ctx context.Context, format string, v ...interface{}) }
var Logger ILogger
Click to show internal directories.
Click to hide internal directories.