Documentation
¶
Index ¶
- Constants
- Variables
- type Entry
- func (entry *Entry) Data(key string, value interface{}) Logger
- func (entry *Entry) Debug(args ...interface{})
- func (entry *Entry) Debugf(format string, args ...interface{})
- func (entry *Entry) Error(args ...interface{})
- func (entry *Entry) Errorf(format string, args ...interface{})
- func (entry *Entry) Fatal(args ...interface{})
- func (entry *Entry) Fatalf(format string, args ...interface{})
- func (entry *Entry) Field(key string, value interface{}) Logger
- func (entry *Entry) Fields(fields context.Fields) Logger
- func (entry *Entry) Info(args ...interface{})
- func (entry *Entry) Infof(format string, args ...interface{})
- func (entry *Entry) Level(level Level) Logger
- func (entry *Entry) Log(level Level, args ...interface{})
- func (entry *Entry) Logf(level Level, format string, args ...interface{})
- func (entry *Entry) Warn(args ...interface{})
- func (entry *Entry) Warnf(format string, args ...interface{})
- type Formatter
- type Grade
- type Hook
- type JsonFormatter
- type JsonLog
- type Level
- type Log
- type Logger
- type TextFormatter
- type Writer
Constants ¶
View Source
const DefaultTimeLayout = "2006-01-02 15:04:05.000"
View Source
const Error = "error"
View Source
const Module = "module"
Variables ¶
View Source
var StdWriter = &stdWriter{level: DEBUG, writer: os.Stdout}
Functions ¶
This section is empty.
Types ¶
type JsonFormatter ¶
type JsonFormatter struct {
// contains filtered or unexported fields
}
func Json ¶
func Json() *JsonFormatter
func (*JsonFormatter) TimeLayout ¶
func (formatter *JsonFormatter) TimeLayout(layout string) *JsonFormatter
type JsonLog ¶
type JsonLog struct { Level string `json:"level"` Time string `json:"time"` Data json.RawMessage `json:"data,omitempty"` Context json.RawMessage `json:"context,omitempty"` Message string `json:"message"` }
type Log ¶
type Log struct { Level Level // 等级 Time time.Time // 事件 Data *context.Context // 数据 Context *context.Context // 上下文 Message string // 格式化信息 }
日志信息
type Logger ¶
type Logger interface { Level(Level) Logger Field(string, interface{}) Logger Fields(context.Fields) Logger Data(string, interface{}) Logger Debug(...interface{}) Debugf(string, ...interface{}) Info(...interface{}) Infof(string, ...interface{}) Warn(...interface{}) Warnf(string, ...interface{}) Error(...interface{}) Errorf(string, ...interface{}) Fatal(...interface{}) Fatalf(string, ...interface{}) }
type TextFormatter ¶
type TextFormatter struct {
// contains filtered or unexported fields
}
func Text ¶
func Text() *TextFormatter
func (*TextFormatter) Level ¶
func (formatter *TextFormatter) Level(level Level) string
func (*TextFormatter) TimeLayout ¶
func (formatter *TextFormatter) TimeLayout(layout string) *TextFormatter
Source Files
¶
Click to show internal directories.
Click to hide internal directories.