Documentation
¶
Index ¶
- Constants
- func Debug(args ...any)
- func Debugf(format string, args ...any)
- func Error(args ...any)
- func Errorf(format string, args ...any)
- func Fatal(args ...any)
- func Fatalf(format string, args ...any)
- func Info(args ...any)
- func Infof(format string, args ...any)
- func Level2Name(level int32) string
- func Name2Format(f string) int32
- func Name2Level(name string) int32
- func Output(skip int, level int32, tag string, args ...any)
- func Outputf(skip int, level int32, tag, format string, args ...any)
- func SetCaller(val bool)
- func SetFormat(f int32)
- func SetLevel(level int32)
- func SetObject(oj *Logger)
- func Trace(args ...any)
- func Tracef(format string, args ...any)
- func Warn(args ...any)
- func Warnf(format string, args ...any)
- type Component
- type Config
- type Data
- type Entry
- type GroupWriter
- type IWriter
- type Logger
- func (l *Logger) Close()
- func (l *Logger) Init(cfg *Config) error
- func (l *Logger) Output(skip int, level int32, tag string, args ...any)
- func (l *Logger) Outputf(skip int, level int32, tag string, format string, args ...any)
- func (l *Logger) SetCaller(val bool)
- func (l *Logger) SetFormat(f int32)
- func (l *Logger) SetLevel(level int32)
- type RollingStrategy
- type RotateWriter
- type StdoutWriter
Constants ¶
View Source
const ( LOG_TRACE = 1 LOG_DEBUG = 2 LOG_WARN = 3 LOG_INFO = 4 LOG_ERROR = 5 LOG_FATAL = 6 FORMAT_LINE = 1 FORMAT_JSON = 2 )
Variables ¶
This section is empty.
Functions ¶
func Level2Name ¶
func Name2Format ¶
func Name2Level ¶
Types ¶
type Config ¶
type Config struct {
Mode string `yaml:"mode,omitempty"` // 日志模式(debug/release)
Path string `yaml:"path,omitempty"` // 日志文件路径
Level string `yaml:"level,omitempty"` // 日志级别
Format string `yaml:"format,omitempty"` // 日志格式(text/json)
Name string `yaml:"name,omitempty"` // 日志名称
IsCaller bool `yaml:"is_caller"` // 是否开启runtime输出
CacheSize int `yaml:"cache_size"` // 缓存大小
}
type Entry ¶
type Entry struct {
TS string `json:"ts,omitempty"`
Level string `json:"level,omitempty"`
File string `json:"file,omitempty"`
Tag string `json:"tag,omitempty"`
Msg any `json:"msg,omitempty"`
}
jsonLogEntry JSON 日志条目结构(sonic 零分配序列化)
type GroupWriter ¶
type GroupWriter struct {
// contains filtered or unexported fields
}
func (*GroupWriter) Close ¶
func (w *GroupWriter) Close() (err error)
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
type RollingStrategy ¶
type RollingStrategy int
RollingStrategy 日志滚动策略
const ( RollingByHour RollingStrategy = iota // 按小时滚动 RollingByDay // 按天滚动 )
type RotateWriter ¶
type RotateWriter struct {
// contains filtered or unexported fields
}
RotateWriter 按小时滚动的日志写入器
func NewRotateWriter ¶
func NewRotateWriter(lpath, lname string, bufferSize int, flushInterval time.Duration, val RollingStrategy) *RotateWriter
New 创建按小时滚动的日志写入器
type StdoutWriter ¶
type StdoutWriter struct{}
func (*StdoutWriter) Close ¶
func (w *StdoutWriter) Close() error
Click to show internal directories.
Click to hide internal directories.