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 SetLogLevel(level logLevel)
- func Warn(v ...interface{})
- func Warnf(foramt string, v ...interface{})
- type FileHandler
- type Handler
- type Logger
- type RotatingFileHandler
- type StdoutHandler
Constants ¶
View Source
const (
DefaultCallerDepth = 2
)
Variables ¶
View Source
var ( FatalLevel = logLevel{1, " [FATAL] "} ErrorLevel = logLevel{2, " [ERROR] "} WarnLevel = logLevel{3, " [WARN] "} InfoLevel = logLevel{4, " [INFO] "} DebugLevel = logLevel{5, " [DEBUG] "} )
Functions ¶
func Debug ¶
func Debug(v ...interface{})
Debug print logs like log.Print, but has a prefix with "[DEBUG]"
func Debugf ¶
func Debugf(format string, v ...interface{})
Debugf print logs like log.Printf, but has a prefix with "[DEBUG]"
func Error ¶
func Error(v ...interface{})
Error print logs like log.Print, but has a prefix with "[ERROR]"
func Errorf ¶
func Errorf(format string, v ...interface{})
Errorf print logs like log.Printf, but has a prefix with "[ERROR]"
func Fatal ¶
func Fatal(v ...interface{})
Fatal print logs like log.Print, but has a prefix with "[FATAL]"
func Fatalf ¶
func Fatalf(format string, v ...interface{})
Fatalf print logs like log.Printf, but has a prefix with "[FATAL]"
func Info ¶
func Info(v ...interface{})
Info print logs like log.Print, but has a prefix with "[INFO]"
func Infof ¶
func Infof(format string, v ...interface{})
Infof print logs like log.Printf, but has a prefix with "[INFO]"
func SetLogLevel ¶
func SetLogLevel(level logLevel)
SetLogLevel set current log level, only the higher level log will be written to the file
Types ¶
type FileHandler ¶
type FileHandler struct {
// contains filtered or unexported fields
}
func NewFileHandler ¶
func NewFileHandler(filename string) *FileHandler
func (*FileHandler) Close ¶
func (handler *FileHandler) Close() error
func (*FileHandler) Flush ¶
func (handler *FileHandler) Flush() error
func (*FileHandler) Writer ¶
func (handler *FileHandler) Writer() io.Writer
type Logger ¶
type Logger struct { Name string // contains filtered or unexported fields }
func (*Logger) AddHandler ¶
type RotatingFileHandler ¶
type RotatingFileHandler struct {
// contains filtered or unexported fields
}
func NewRotatingFileHandler ¶
func NewRotatingFileHandler(filename string) *RotatingFileHandler
func (*RotatingFileHandler) Close ¶
func (handler *RotatingFileHandler) Close() error
func (*RotatingFileHandler) Flush ¶
func (handler *RotatingFileHandler) Flush() error
func (*RotatingFileHandler) SetDateFormat ¶
func (handler *RotatingFileHandler) SetDateFormat(f string) *RotatingFileHandler
func (*RotatingFileHandler) Writer ¶
func (handler *RotatingFileHandler) Writer() io.Writer
type StdoutHandler ¶
type StdoutHandler struct { }
func NewStdoutHandler ¶
func NewStdoutHandler() *StdoutHandler
func (*StdoutHandler) Close ¶
func (handler *StdoutHandler) Close() error
func (*StdoutHandler) Flush ¶
func (handlere *StdoutHandler) Flush() error
func (*StdoutHandler) Writer ¶
func (handler *StdoutHandler) Writer() io.Writer
Click to show internal directories.
Click to hide internal directories.