Documentation ¶
Index ¶
- Constants
- Variables
- func Debug(args ...interface{})
- func Debugf(format string, args ...interface{})
- func Error(args ...interface{})
- func Errorf(format string, args ...interface{})
- func Fatal(args ...interface{})
- func Fatalf(format string, args ...interface{})
- func Info(args ...interface{})
- func Infof(format string, args ...interface{})
- func New(opts ...Option) *logger
- func Panic(args ...interface{})
- func Panicf(format string, args ...interface{})
- func SetOptions(opts ...Option)
- func StdLogger() *logger
- func Warn(args ...interface{})
- func Warnf(format string, args ...interface{})
- func Writer() io.Writer
- type Entry
- type Formatter
- type JsonFormatter
- type Level
- type Option
- type TextFormatter
Constants ¶
View Source
const (
FmtEmptySeparate = ""
)
Variables ¶
View Source
var LevelNameMapping = map[Level]string{ DebugLevel: "DEBUG", InfoLevel: "INFO", WarnLevel: "WARN", ErrorLevel: "ERROR", PanicLevel: "PANiC", FatalLevel: "Fatal", }
LevelNameMapping log level string name mapping
Functions ¶
func SetOptions ¶
func SetOptions(opts ...Option)
Types ¶
type Entry ¶
type Entry struct { Buffer *bytes.Buffer Map map[string]interface{} Level Level Time time.Time File string Line int Func string Format string Args []interface{} // contains filtered or unexported fields }
Entry 将日志记录到支持的输出
type Formatter ¶
type Formatter interface { // Maybe in async goroutine // Please write the result to buffer Format(entry *Entry) error }
Formatter 自定义日志输出格式
type JsonFormatter ¶
type JsonFormatter struct {
IgnoreBasicFields bool
}
func (*JsonFormatter) Format ¶
func (f *JsonFormatter) Format(e *Entry) error
type Option ¶
type Option func(*options)
func WithDisableCaller ¶
func WithFormatter ¶
func WithOutput ¶
func WithStdLevel ¶
type TextFormatter ¶
type TextFormatter struct {
IgnoreBasicFields bool
}
func (*TextFormatter) Format ¶
func (f *TextFormatter) Format(e *Entry) error
Source Files ¶
Click to show internal directories.
Click to hide internal directories.