Documentation
¶
Index ¶
- Variables
- func ColorByLevel(level string) int
- func GetTraceID(entry *logrus.Entry) string
- func Limit(ll *logrus.Logger, level logrus.Level, msg []byte, formatter *LogrusFormatter) (filteredMsg []byte, limited bool)
- func ParseLevelFromMsg(msg []byte) (level logrus.Level, s []byte, foundLevelTag bool)
- func RegisterLevelKey(levelKey string, level logrus.Level)
- func RegisterLimitConf(limitConf LimitConf)
- type AsyncConfig
- type CallerPart
- type ContextPart
- type DiscardFormatter
- type Entry
- type EntryItem
- type Fields
- type FieldsPart
- type Formatter
- type GidPart
- type Hook
- type Layout
- type LevelPart
- type LimitConf
- type LiteralPart
- type LogFileReset
- type LogrusEntry
- type LogrusFormatter
- type MessagePart
- type NewLinePart
- type Option
- type Part
- type PidPart
- type Result
- type Time
- type TracePart
Constants ¶
This section is empty.
Variables ¶
View Source
var Pid = os.Getpid()
Functions ¶
func ColorByLevel ¶
func GetTraceID ¶
func ParseLevelFromMsg ¶
func RegisterLevelKey ¶
RegisterLevelKey customizes the log level key in the message, like [DEBUG] for debugging level.
func RegisterLimitConf ¶
func RegisterLimitConf(limitConf LimitConf)
Types ¶
type AsyncConfig ¶
type AsyncConfig struct {
QueueSize int
}
type CallerPart ¶
type ContextPart ¶
type DiscardFormatter ¶
type DiscardFormatter struct{}
type Entry ¶
type Entry interface { Time() time.Time Level() string TraceID() string Fields() Fields Message() string // Caller returns Calling method, with package name Caller() *runtime.Frame }
Entry is an interface for log entry.
type EntryItem ¶
type EntryItem struct { EntryTime time.Time EntryLevel string EntryTraceID string EntryFields Fields EntryMessage string }
EntryItem is an entry to log.
type FieldsPart ¶
type FieldsPart struct{}
type Formatter ¶
func (Formatter) PrintCallerInfo ¶
type Hook ¶
type Hook struct {
Writers []*rotate.WriterFormatter
}
Hook is a hook to handle writing to local log files.
func NewHook ¶
func NewHook(writers []*rotate.WriterFormatter) *Hook
NewHook returns new LFS hook. Output can be a string, io.Writer, WriterMap or PathMap. If using io.Writer or WriterMap, user is responsible for closing the used io.Writer.
type Layout ¶
type Layout struct {
Parts []Part
}
Layout describes the parsed layout of expression.
func (*Layout) ResetForLogFile ¶
type LevelPart ¶
func (LevelPart) ResetForLogFile ¶
type LimitConf ¶
func ParseLimitConf ¶
type LiteralPart ¶
type LiteralPart string
type LogFileReset ¶
type LogFileReset interface {
ResetForLogFile() Part
}
type LogrusEntry ¶
func (LogrusEntry) Caller ¶
func (e LogrusEntry) Caller() *runtime.Frame
func (LogrusEntry) Fields ¶
func (e LogrusEntry) Fields() Fields
func (LogrusEntry) Level ¶
func (e LogrusEntry) Level() string
func (LogrusEntry) Message ¶
func (e LogrusEntry) Message() string
func (LogrusEntry) Time ¶
func (e LogrusEntry) Time() time.Time
func (LogrusEntry) TraceID ¶
func (e LogrusEntry) TraceID() string
type LogrusFormatter ¶
type LogrusFormatter struct {
Formatter
}
type MessagePart ¶
type MessagePart struct {
SingleLine bool
}
type NewLinePart ¶
type NewLinePart struct{}
type Option ¶
type Option struct { Layout string Level string Rotate string LogPath string TotalSizeCap int64 // 可选,用来指定所有日志文件的总大小上限,例如设置为3GB的话,那么到了这个值,就会删除旧的日志 MaxSize int64 MaxAge time.Duration GzipAge time.Duration Simple bool Stdout bool PrintCaller bool PrintColor bool FixStd bool // 是否增强log.Print...的输出 }
Option defines the options to setup logrus logging system.
Click to show internal directories.
Click to hide internal directories.