Documentation ¶
Index ¶
- Constants
- Variables
- func ClearSubscribers(g event.SubscriberGroup)
- func Critical(l Logger, fields ...interface{})
- func Criticalf(l Logger, msg string, fields ...interface{})
- func Debug(l Logger, fields ...interface{})
- func Debugf(l Logger, msg string, fields ...interface{})
- func Error(l Logger, fields ...interface{})
- func Errorf(l Logger, msg string, fields ...interface{})
- func Info(l Logger, fields ...interface{})
- func Infof(l Logger, msg string, fields ...interface{})
- func Panic(l Logger, fields ...interface{})
- func Panicf(l Logger, msg string, fields ...interface{})
- func RemoveSubscriber(g event.SubscriberGroup, ids ...string) error
- func RuntimeCaller(skip int) func() interface{}
- func RuntimeCallers(skip int) func() interface{}
- func Subscriber(g event.SubscriberGroup, fn func(...interface{})) (event.Subscriber, error)
- func ToLevelName(lvl Level) string
- func Warn(l Logger, fields ...interface{})
- func Warnf(l Logger, msg string, fields ...interface{})
- type Caller
- type Event
- type FileOption
- func FileBuffer(buffer int) FileOption
- func FileFileName(name string) FileOption
- func FileLevel(lvl Level) FileOption
- func FileMaxBackupFile(num int) FileOption
- func FileMaxLength(length int64) FileOption
- func FileMoveFileType(typ MoveFileType) FileOption
- func FileSeparator(separator string) FileOption
- type FileOptions
- type FileSort
- type Level
- type Logger
- type LogrusOption
- type LogrusOptions
- type MoveFileType
- type Publisher
- type STDOption
- type STDOptions
Constants ¶
View Source
const ( TraceLevel = Level(iota) DebugLevel InfoLevel WarnLevel ErrorLevel CriticalLevel PanicLevel LevelNameUnknown = "NULL" LevelNameTrace = "TRAC" LevelNameDebug = "DEBU" LevelNameInfo = "INFO" LevelNameWarn = "WARN" LevelNameError = "ERRO" LevelNameCritical = "CRIT" LevelNamePanic = "PANC" )
define levels
Variables ¶
View Source
var LevelColors = map[Level]string{ TraceLevel: levelColorInfo, DebugLevel: levelColorDebug, InfoLevel: levelColorInfo, WarnLevel: levelColorWarn, ErrorLevel: levelColorError, CriticalLevel: levelColorCritical, }
LevelColors printer's color
Functions ¶
func RemoveSubscriber ¶
func RemoveSubscriber(g event.SubscriberGroup, ids ...string) error
RemoveSubscriber 删除个人的操作函数
func RuntimeCaller ¶ added in v0.21.5
func RuntimeCaller(skip int) func() interface{}
RuntimeCaller stores a stacktrace under the key "stacktrace".
func RuntimeCallers ¶ added in v0.21.5
func RuntimeCallers(skip int) func() interface{}
func Subscriber ¶
func Subscriber(g event.SubscriberGroup, fn func(...interface{})) (event.Subscriber, error)
Subscriber 注册个人的操作函数
Types ¶
type FileOption ¶ added in v0.21.2
type FileOption func(*FileOptions)
FileOption 操作配置函数
func FileMaxBackupFile ¶ added in v0.21.2
func FileMaxBackupFile(num int) FileOption
FileMaxBackupFile 文件最大数量
func FileMaxLength ¶ added in v0.21.2
func FileMaxLength(length int64) FileOption
FileMaxLength 设置最大文件大小
func FileMoveFileType ¶ added in v0.21.2
func FileMoveFileType(typ MoveFileType) FileOption
FileMoveFileType 设置移动文件的类型
func FileSeparator ¶ added in v0.21.2
func FileSeparator(separator string) FileOption
FileSeparator 设置打印分隔符
type FileOptions ¶ added in v0.21.2
type FileOptions struct {
// contains filtered or unexported fields
}
FileOptions file options
type Logger ¶
type Logger interface { SetLevel(lvl Level) WithPrefix(kvs ...interface{}) Logger Log(keyvals ...interface{}) error Debug(kvs ...interface{}) Debugf(msg string, kvs ...interface{}) Info(kvs ...interface{}) Infof(msg string, kvs ...interface{}) Warn(kvs ...interface{}) Warnf(msg string, kvs ...interface{}) Error(kvs ...interface{}) Errorf(msg string, kvs ...interface{}) Critical(kvs ...interface{}) Criticalf(msg string, kvs ...interface{}) Panic(kvs ...interface{}) Panicf(msg string, kvs ...interface{}) event.Subscriber }
Logger 日志对象
func NewFileLogger ¶ added in v0.21.2
func NewFileLogger(opts ...FileOption) (Logger, error)
NewFileLogger 标准窗体的输出对象
func NewLogrusLogger ¶ added in v0.21.2
func NewLogrusLogger(l logrus.FieldLogger, opts ...LogrusOption) Logger
NewLogrusLogger logrus logger
func NewStdLogger ¶ added in v0.21.2
NewStdLogger new std logger
type LogrusOptions ¶ added in v0.21.2
type LogrusOptions struct {
// contains filtered or unexported fields
}
LogrusOptions options
type MoveFileType ¶
type MoveFileType int
MoveFileType move file type
const ( MoveFileTypeNothing MoveFileType = iota // 不移动 MoveFileTypePerMinite // 按分钟移动 MoveFileTypeHourly // 按小时移动 MoveFileTypeDaily // 按天移动 )
MoveFileTypes
type Publisher ¶ added in v0.21.2
type Publisher interface { Log(Level, ...interface{}) Logf(Level, string, ...interface{}) WithPrefix(kvs ...interface{}) Publisher SetLevel(lvl Level) event.SubscriberGroup }
Publisher publish some informations
type STDOptions ¶ added in v0.21.2
type STDOptions struct {
// contains filtered or unexported fields
}
STDOptions std options
Source Files ¶
Click to show internal directories.
Click to hide internal directories.