Documentation ¶
Index ¶
- Constants
- Variables
- func Debug(v ...interface{})
- func Debugf(format string, v ...interface{})
- func Error(v ...interface{})
- func Errorf(format string, v ...interface{})
- func Fatal(v ...interface{})
- func Fatalf(format string, v ...interface{})
- func Info(v ...interface{})
- func Infof(format string, v ...interface{})
- func Notice(v ...interface{})
- func Noticef(format string, v ...interface{})
- func Panic(v ...interface{})
- func Panicf(format string, v ...interface{})
- func Warn(v ...interface{})
- func Warnf(format string, v ...interface{})
- type DateFormat
- type FileFormat
- type FileInfo
- type FileOptions
- type FileWriter
- type HttpWriter
- type LogContent
- type LogFormat
- type LogOptions
- type Logger
- func (log *Logger) Debug(format string, v ...interface{})
- func (log *Logger) Error(format string, v ...interface{})
- func (log *Logger) Fatal(format string, v ...interface{})
- func (log *Logger) GetCallDepth() int
- func (log *Logger) Info(format string, v ...interface{})
- func (log *Logger) Notice(format string, v ...interface{})
- func (log *Logger) Panic(format string, v ...interface{})
- func (log *Logger) SetCallDepth(depth int) *Logger
- func (log *Logger) SetCallDepthPlus() *Logger
- func (log *Logger) SetColor(color bool) *Logger
- func (log *Logger) SetFlag(flag int) *Logger
- func (log *Logger) SetFormat(logFormat LogFormat) *Logger
- func (log *Logger) SetLevel(level int) *Logger
- func (log *Logger) SetPrefix(prefix string) *Logger
- func (log *Logger) SetWriter(w io.Writer) *Logger
- func (log *Logger) Warn(format string, v ...interface{})
- type StorageType
Constants ¶
View Source
const ( LogDate = 1 << iota LogTime LogMicroSeconds LogLongFile LogShortFile LogModule LogLevel )
View Source
const ( LevelTest = iota LevelDebug LevelInfo LevelNotice LevelWarn LevelError LevelPanic LevelFatal )
Variables ¶
View Source
var ( // StdFlags std flags StdFlags = LogDate | LogMicroSeconds | LogShortFile | LogLevel )
Functions ¶
Types ¶
type DateFormat ¶ added in v0.0.2
type DateFormat int
LogFormat logformat enum
const ( LongDateFormat DateFormat = iota ShortDateFormat )
type FileFormat ¶ added in v0.0.2
type FileFormat int
LogFormat logformat enum
const ( LongFileFormat FileFormat = iota ShortFileFormat )
type FileOptions ¶
type FileOptions struct { // StorageType 存储的时间类型 StorageType StorageType // MaxDay 日志最大保存天数 MaxDay int // Dir 日志保存目录 Dir string // Prefix 文件名前缀 Prefix string // contains filtered or unexported fields }
FileOptions 文件存储选项
type FileWriter ¶
type FileWriter struct { FileOptions // contains filtered or unexported fields }
FileWriter 文件存储实现
func NewFileWriter ¶
func NewFileWriter(opts ...FileOptions) *FileWriter
type HttpWriter ¶ added in v0.0.2
type HttpWriter struct {
// contains filtered or unexported fields
}
func NewHttpWriter ¶ added in v0.0.2
func NewHttpWriter(url string) *HttpWriter
type LogContent ¶
type LogContent struct { Prefix string `json:"prefix"` Time string `json:"time"` Level string `json:"level"` File string `json:"file"` Msg string `json:"msg"` Color bool `json:"-"` LevelInt int `json:"-"` }
func (*LogContent) Json ¶
func (cc *LogContent) Json() []byte
Json LogContent to json
returns []byte
func (*LogContent) Text ¶
func (cc *LogContent) Text() []byte
Text LogContent to Text
returns []byte
type LogOptions ¶ added in v0.0.2
type LogOptions struct {
// contains filtered or unexported fields
}
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger logger struct
call logx.New() returns *Logger
func (*Logger) GetCallDepth ¶
func (*Logger) SetCallDepth ¶
func (*Logger) SetCallDepthPlus ¶
type StorageType ¶
type StorageType int
const ( // StorageTypeMinutes 按分钟存储 StorageTypeMinutes StorageType = iota // StorageTypeHour 按小时存储 StorageTypeHour // StorageTypeDay 按天存储 StorageTypeDay // StorageTypeMonth 按月存储 StorageTypeMonth )
Click to show internal directories.
Click to hide internal directories.