Documentation ¶
Index ¶
- Constants
- Variables
- func AddFlag(flag int)
- func CleanZinxLog(log *ZinxLogger)
- func CloseDebug()
- 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 OpenDebug()
- func Panic(v ...interface{})
- func Panicf(format string, v ...interface{})
- func ResetFlags(flag int)
- func SetLogFile(fileDir string, fileName string)
- func SetPrefix(prefix string)
- func Stack(v ...interface{})
- func Warn(v ...interface{})
- func Warnf(format string, v ...interface{})
- type ZinxLogger
- func (log *ZinxLogger) AddFlag(flag int)
- func (log *ZinxLogger) CloseDebug()
- func (log *ZinxLogger) Debug(v ...interface{})
- func (log *ZinxLogger) Debugf(format string, v ...interface{})
- func (log *ZinxLogger) Error(v ...interface{})
- func (log *ZinxLogger) Errorf(format string, v ...interface{})
- func (log *ZinxLogger) Fatal(v ...interface{})
- func (log *ZinxLogger) Fatalf(format string, v ...interface{})
- func (log *ZinxLogger) Flags() int
- func (log *ZinxLogger) Info(v ...interface{})
- func (log *ZinxLogger) Infof(format string, v ...interface{})
- func (log *ZinxLogger) OpenDebug()
- func (log *ZinxLogger) OutPut(level int, s string) error
- func (log *ZinxLogger) Panic(v ...interface{})
- func (log *ZinxLogger) Panicf(format string, v ...interface{})
- func (log *ZinxLogger) ResetFlags(flag int)
- func (log *ZinxLogger) SetLogFile(fileDir string, fileName string)
- func (log *ZinxLogger) SetPrefix(prefix string)
- func (log *ZinxLogger) Stack(v ...interface{})
- func (log *ZinxLogger) Warn(v ...interface{})
- func (log *ZinxLogger) Warnf(format string, v ...interface{})
Constants ¶
View Source
const ( BitDate = 1 << iota // 日期标记位 2019/01/23 BitTime // 时间标记位 01:23:12 BitMicroSeconds // 微秒级标记位 01:23:12.111222 BitLongFile // 完整文件名称 /home/go/src/zinx/server.go BitShortFile // 最后文件名 server.go BitLevel // 当前日志级别: 0(Debug), 1(Info), 2(Warn), 3(Error), 4(Panic), 5(Fatal) BitStdFlag = BitDate | BitTime // 标准头部日志格式 BitDefault = BitLevel | BitShortFile | BitStdFlag // 默认日志头部格式 )
日志头部信息标记位,采用bitmap方式,用户可以选择头部需要哪些标记位被打印
View Source
const ( LogDebug = iota LogInfo LogWarn LogError LogPanic LogFatal )
日志级别
View Source
const (
LOG_MAX_BUF = 1024 * 1024
)
Variables ¶
View Source
var StdZinxLog = NewZinxLog(os.Stderr, "", BitDefault)
StdZinxLog 全局日志对象
全局默认提供一个Log对外句柄,可以直接使用API系列调用
Functions ¶
Types ¶
type ZinxLogger ¶
type ZinxLogger struct {
// contains filtered or unexported fields
}
func NewZinxLog ¶
func NewZinxLog(out io.Writer, prefix string, flag int) *ZinxLogger
NewZinxLog 创建一个日志
@out 标准输出的文件io @prefix 日志的前缀 @flag 当前日志头部信息的标记位
func (*ZinxLogger) CloseDebug ¶
func (log *ZinxLogger) CloseDebug()
func (*ZinxLogger) Debug ¶
func (log *ZinxLogger) Debug(v ...interface{})
func (*ZinxLogger) Debugf ¶
func (log *ZinxLogger) Debugf(format string, v ...interface{})
====> Debug <====
func (*ZinxLogger) Error ¶
func (log *ZinxLogger) Error(v ...interface{})
func (*ZinxLogger) Errorf ¶
func (log *ZinxLogger) Errorf(format string, v ...interface{})
====> Error <====
func (*ZinxLogger) Fatal ¶
func (log *ZinxLogger) Fatal(v ...interface{})
func (*ZinxLogger) Fatalf ¶
func (log *ZinxLogger) Fatalf(format string, v ...interface{})
====> Fatal 需要终止程序 <====
func (*ZinxLogger) Info ¶
func (log *ZinxLogger) Info(v ...interface{})
func (*ZinxLogger) Infof ¶
func (log *ZinxLogger) Infof(format string, v ...interface{})
====> Info <====
func (*ZinxLogger) OpenDebug ¶
func (log *ZinxLogger) OpenDebug()
func (*ZinxLogger) OutPut ¶
func (log *ZinxLogger) OutPut(level int, s string) error
OutPut 输出日志文件,原方法
func (*ZinxLogger) Panic ¶
func (log *ZinxLogger) Panic(v ...interface{})
func (*ZinxLogger) Panicf ¶
func (log *ZinxLogger) Panicf(format string, v ...interface{})
====> Panic <====
func (*ZinxLogger) ResetFlags ¶
func (log *ZinxLogger) ResetFlags(flag int)
ResetFlags 重新设置日志Flags bitMap 标记位
func (*ZinxLogger) SetLogFile ¶
func (log *ZinxLogger) SetLogFile(fileDir string, fileName string)
SetLogFile 设置日志文件输出
func (*ZinxLogger) SetPrefix ¶
func (log *ZinxLogger) SetPrefix(prefix string)
SetPrefix 设置日志的 用户自定义前缀字符串
func (*ZinxLogger) Warn ¶
func (log *ZinxLogger) Warn(v ...interface{})
func (*ZinxLogger) Warnf ¶
func (log *ZinxLogger) Warnf(format string, v ...interface{})
====> Warn <====
Click to show internal directories.
Click to hide internal directories.