Documentation ¶
Overview ¶
color 实现 sam 2020-09-29
logy 写日志文件的实现 sam 2020-10-09
logy logger 实现
report log to nsq server sam 2020-12-21
logy std 标准输出实现 sam 2020-09-29
Index ¶
- Constants
- func CallDepth() int
- 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 Flags() int
- 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 SetCallDepth(depth int)
- func SetFileFormat(s StorageType, format string)
- func SetFlags(flag int)
- func SetLevel(level int)
- func SetOutput(w Writer, prefix string)
- func Warn(v ...interface{})
- func Warnf(format string, v ...interface{})
- type FileInfo
- type FileWriter
- type FileWriterOptions
- type HTTPWriter
- type LogData
- type Logger
- func (l *Logger) CallDepth() int
- func (l *Logger) Debug(format string, v ...interface{})
- func (l *Logger) Error(format string, v ...interface{})
- func (l *Logger) Fatal(format string, v ...interface{})
- func (l *Logger) Flags() int
- func (l *Logger) Info(format string, v ...interface{})
- func (l *Logger) Notice(format string, v ...interface{})
- func (l *Logger) Panic(format string, v ...interface{})
- func (l *Logger) Prefix() string
- func (l *Logger) SetCallDepth(depth int)
- func (l *Logger) SetFlags(flag int)
- func (l *Logger) SetLevel(level int)
- func (l *Logger) SetOutput(w Writer, prefix string)
- func (l *Logger) SetPrefix(prefix string)
- func (l *Logger) Warn(format string, v ...interface{})
- type NsqWriter
- type StorageType
- type Writer
Constants ¶
View Source
const ( Ldate = 1 << iota // the date in the local time zone: 2006-01-02 Ltime // the time in the local time zone: 15:04:05 Lmicroseconds // microsecond resolution: 01:23:23.123. assumes Ltime. Llongfile // full file name and line number: /a/b/c/d.go:23 Lshortfile // final file name element and line number: d.go:23. overrides Llongfile LUTC // if Ldate or Ltime is set, use UTC rather than the local time zone Lmodule // module name Llevel // the level of the logy LstdFlags = Ldate | Ltime | Lshortfile | Llevel // initial values for the standard logger )
View Source
const ( LevelDebug LevelInfo LevelNotice LevelWarn LevelError LevelPanic LevelFatal )
Variables ¶
This section is empty.
Functions ¶
func SetCallDepth ¶ added in v0.1.0
func SetCallDepth(depth int)
Types ¶
type FileWriter ¶ added in v0.1.0
type FileWriter struct { FileWriterOptions sync.Mutex // contains filtered or unexported fields }
FileWriter 文件存储实现
func NewFileWriter ¶
func NewFileWriter(opts ...FileWriterOptions) *FileWriter
NewFileWriter return a new FileWriter
struct FileWriterOptions
type FileWriterOptions ¶ added in v0.1.0
type FileWriterOptions struct { StorageType StorageType //存储类型 StorageMaxDay int //最大保存天数 Dir string //目录 Prefix string //前缀 // contains filtered or unexported fields }
FileWriterOption
type HTTPWriter ¶ added in v0.1.0
HTTPWriter http api writer
func NewHTTPWriter ¶ added in v0.1.0
func NewHTTPWriter(url, method, token string, level int) *HTTPWriter
NewHTTPWriter return new HTTPWriter
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
func (*Logger) SetCallDepth ¶ added in v0.1.0
type NsqWriter ¶ added in v0.3.5
func NewNsqWriter ¶ added in v0.3.5
NewNsqWriter return new NsqWriter
host nsq 主机地址 topic 一个nsq topic level 记录错误等级
type StorageType ¶ added in v0.1.0
type StorageType int
StorageType 文件存储类型
const ( //按分钟存储 StorageTypeMinutes StorageType = iota //按小时存储 StorageTypeHour //按天存储 StorageTypeDay //按月份存储 StorageTypeMonth )
type Writer ¶ added in v0.1.0
Writer writer interface
func MultiWriter ¶ added in v0.1.0
MultiWriter return a Writer interface
func NewMutexWriter ¶ added in v0.1.0
NewMutexWriter returns a currently safe writer.
Click to show internal directories.
Click to hide internal directories.