Documentation ¶
Index ¶
- func AddWriter(lw LogWriter) error
- func AsyncWrite()
- func Debug(v ...interface{})
- func Debugf(format string, v ...interface{})
- func Debugln(v ...interface{})
- func Error(v ...interface{})
- func Errorf(format string, v ...interface{})
- func Errorln(v ...interface{})
- func Fatal(v ...interface{})
- func Fatalf(format string, v ...interface{})
- func Fatalln(v ...interface{})
- func Flush()
- func HideLocation()
- func Info(v ...interface{})
- func Infof(format string, v ...interface{})
- func Infoln(v ...interface{})
- func InitLogger(logger *Logger)
- func SetCallDepth(d int)
- func SetLevel(l Level)
- func Start()
- func Stop()
- func Warn(v ...interface{})
- func Warnf(format string, v ...interface{})
- func Warnln(v ...interface{})
- type BufPool
- type ConsoleWriter
- type FileWriter
- type Level
- type LogWriter
- type Logger
- func (logger *Logger) AddWriter(writer LogWriter) error
- func (logger *Logger) AsyncWrite()
- func (logger *Logger) Debug(v ...interface{})
- func (logger *Logger) Debugf(format string, v ...interface{})
- func (logger *Logger) Debugln(v ...interface{})
- func (logger *Logger) Error(v ...interface{})
- func (logger *Logger) Errorf(format string, v ...interface{})
- func (logger *Logger) Errorln(v ...interface{})
- func (logger *Logger) Fatal(v ...interface{})
- func (logger *Logger) Fatalf(format string, v ...interface{})
- func (logger *Logger) Fatalln(v ...interface{})
- func (logger *Logger) Flush()
- func (logger *Logger) GetLevel() (l Level)
- func (logger *Logger) HideLocation()
- func (logger *Logger) Info(v ...interface{})
- func (logger *Logger) Infof(format string, v ...interface{})
- func (logger *Logger) Infoln(v ...interface{})
- func (logger *Logger) SetCallDepth(d int)
- func (logger *Logger) SetLevel(l Level)
- func (logger *Logger) Start()
- func (logger *Logger) Stop()
- func (logger *Logger) Warn(v ...interface{})
- func (logger *Logger) Warnf(format string, v ...interface{})
- func (logger *Logger) Warnln(v ...interface{})
- type SlackMsg
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Fatalf ¶
func Fatalf(format string, v ...interface{})
Fatalf generates a fatal-level log and exits the program.
func Fatalln ¶
func Fatalln(v ...interface{})
Fatalln generates a fatal-level log and exits the program.
func SetCallDepth ¶
func SetCallDepth(d int)
SetCallDepth sets the global defaultLogger's call depth.
Types ¶
type BufPool ¶
type BufPool struct {
// contains filtered or unexported fields
}
BufPool wraps sync.Pool to make it handy.
type ConsoleWriter ¶
type ConsoleWriter struct {
// contains filtered or unexported fields
}
ConsoleWriter is responsible for writing log to console.
func NewConsoleWriter ¶
func NewConsoleWriter() *ConsoleWriter
NewConsoleWriter returns a new instance of ConsoleWriter.
func (*ConsoleWriter) GetLevel ¶
func (cw *ConsoleWriter) GetLevel() Level
GetLevel returns the log level.
func (*ConsoleWriter) SetLevel ¶
func (cw *ConsoleWriter) SetLevel(l Level)
SetLevel sets the log level.
type FileWriter ¶
type FileWriter struct {
// contains filtered or unexported fields
}
FileWriter is responsible for writing log to file.
func NewFileWriter ¶
func NewFileWriter(filepath, name, url, channel string) *FileWriter
NewFileWriter returns a new instance of NewFileWriter.
func (*FileWriter) GetLevel ¶
func (fw *FileWriter) GetLevel() Level
GetLevel returns the log level.
type LogWriter ¶
type LogWriter interface { Init() error SetLevel(Level) GetLevel() Level Write(msg string, level Level) error Flush() error Close() error }
LogWriter defines writer's API.
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger is the core struct of ilog package. It packs message and sends it to the writer.
func NewConsoleLogger ¶
func NewConsoleLogger() *Logger
NewConsoleLogger returns a Logger instance with a console writer.
func (*Logger) AsyncWrite ¶
func (logger *Logger) AsyncWrite()
AsyncWrite sets logger's syncWrite to false.
func (*Logger) Debug ¶
func (logger *Logger) Debug(v ...interface{})
Debug generates a debug-level log.
func (*Logger) Debugln ¶
func (logger *Logger) Debugln(v ...interface{})
Debugln generates a debug-level log.
func (*Logger) Error ¶
func (logger *Logger) Error(v ...interface{})
Error generates a error-level log.
func (*Logger) Errorln ¶
func (logger *Logger) Errorln(v ...interface{})
Errorln generates a error-level log.
func (*Logger) Fatal ¶
func (logger *Logger) Fatal(v ...interface{})
Fatal generates a fatal-level log and exits the program.
func (*Logger) Fatalln ¶
func (logger *Logger) Fatalln(v ...interface{})
Fatalln generates a fatal-level log and exits the program.
func (*Logger) HideLocation ¶
func (logger *Logger) HideLocation()
HideLocation sets logger's showLocation to false.
func (*Logger) Infoln ¶
func (logger *Logger) Infoln(v ...interface{})
Infoln generates a info-level log.
func (*Logger) SetCallDepth ¶
SetCallDepth sets the logger's call depth.