Documentation
¶
Index ¶
- Constants
- type FileWriter
- type FlatFormatter
- type JSONFormatter
- type Logger
- func (l *Logger) AppendWriters(writers ...io.Writer) *Logger
- func (l *Logger) Close()
- func (l *Logger) Debug(v interface{}, args ...interface{})
- func (l *Logger) DebugOff() *Logger
- func (l *Logger) DebugOn() *Logger
- func (l *Logger) Error(v interface{}, args ...interface{})
- func (l *Logger) ErrorOff() *Logger
- func (l *Logger) ErrorOn() *Logger
- func (l *Logger) Fatal(v interface{}, args ...interface{})
- func (l *Logger) FatalOff() *Logger
- func (l *Logger) FatalOn() *Logger
- func (l *Logger) Info(v interface{}, args ...interface{})
- func (l *Logger) InfoOff() *Logger
- func (l *Logger) InfoOn() *Logger
- func (l *Logger) SetWriters(writers ...io.Writer) *Logger
- func (l *Logger) Trace(v interface{}, args ...interface{})
- func (l *Logger) TraceOff() *Logger
- func (l *Logger) TraceOn() *Logger
- func (l *Logger) UseFlatFormat() *Logger
- func (l *Logger) UseFormatter(f formatter) *Logger
- func (l *Logger) UseJSONFormat(indent bool) *Logger
- func (l *Logger) Warn(v interface{}, args ...interface{})
- func (l *Logger) WarnOff() *Logger
- func (l *Logger) WarnOn() *Logger
Constants ¶
View Source
const ( RotMin = 1 RotHour = 2 RotDay = 3 )
View Source
const ( DebugFilter = 1 TraceFilter = 2 InfoFilter = 4 WarnFilter = 8 ErrorFilter = 16 FatalFilter = 32 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileWriter ¶
type FileWriter struct {
// contains filtered or unexported fields
}
func NewFileWriter ¶
func NewFileWriter() *FileWriter
func (*FileWriter) Filename ¶
func (w *FileWriter) Filename(filename string) *FileWriter
func (*FileWriter) RotateDay ¶
func (w *FileWriter) RotateDay() *FileWriter
func (*FileWriter) RotateHour ¶
func (w *FileWriter) RotateHour() *FileWriter
func (*FileWriter) RotateMin ¶
func (w *FileWriter) RotateMin() *FileWriter
type FlatFormatter ¶
type FlatFormatter struct { }
FlatFormatter format log with flat text
func (*FlatFormatter) Format ¶
func (f *FlatFormatter) Format(level, file, callstack string, msg interface{}) string
Format convert log to flat text
type JSONFormatter ¶
type JSONFormatter struct { Date string `json:"date"` Lev string `json:"lev"` Msg interface{} `json:"msg"` File string `json:"file,omitempty"` Callstack []string `json:"callstack,omitempty"` // contains filtered or unexported fields }
JSONFormatter format log with json
func (*JSONFormatter) Format ¶
func (f *JSONFormatter) Format(level, file, callstack string, msg interface{}) string
Format convert log to json text
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger logger struct
func (*Logger) AppendWriters ¶
AppendWriters append custom writers
func (*Logger) Debug ¶
func (l *Logger) Debug(v interface{}, args ...interface{})
Debug Write log use debug level
func (*Logger) Error ¶
func (l *Logger) Error(v interface{}, args ...interface{})
Warn Write log use error level
func (*Logger) Fatal ¶
func (l *Logger) Fatal(v interface{}, args ...interface{})
Fatal Write log use fatal level
func (*Logger) Info ¶
func (l *Logger) Info(v interface{}, args ...interface{})
Info Write log use info level
func (*Logger) SetWriters ¶
SetWriters set custom writers
func (*Logger) Trace ¶
func (l *Logger) Trace(v interface{}, args ...interface{})
Trace Write log use trace level
func (*Logger) UseFlatFormat ¶
UseFlatFormat use flat format
func (*Logger) UseFormatter ¶
UseFormatter set custom formatter
func (*Logger) UseJSONFormat ¶
UseJSONFormat use json format
Click to show internal directories.
Click to hide internal directories.