Documentation
¶
Index ¶
- Constants
- func DailyFileOutput(prefix, dirpath string) (*os.File, error)
- 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 SetDefaultLogger(l Logger)
- func Warning(v ...interface{})
- func Warningf(format string, v ...interface{})
- type Level
- type Logger
Constants ¶
View Source
const ( // DebugLevel informs information for debugging purpose DebugLevel = "DEBUG" // InfoLevel informs that there is a useful information InfoLevel = "INFO" // WarningLevel informs that we need to pay more attention on something WarningLevel = "WARNING" // ErrorLevel informs that an error occured ErrorLevel = "ERROR" // FatalLevel informs that we are having a panic FatalLevel = "FATAL" )
Variables ¶
This section is empty.
Functions ¶
func DailyFileOutput ¶
DailyFileOutput creates file to output log messages which has extension '.log'. The log file will be rolled each day with name format prefix_yyyymmdd.log and saved inside dirpath. If dirpath not exists, it will be created.
func Debugf ¶
func Debugf(format string, v ...interface{})
Debugf is bridge for Logger.Debugf of default defaultLogger
func Errorf ¶
func Errorf(format string, v ...interface{})
Errorf is bridge for Logger.Errorf of default defaultLogger
func Fatalf ¶
func Fatalf(format string, v ...interface{})
Fatalf is bridge for Logger.Fatalf of default defaultLogger
func Infof ¶
func Infof(format string, v ...interface{})
Infof is bridge for Logger.Infof of default defaultLogger
func SetDefaultLogger ¶
func SetDefaultLogger(l Logger)
SetDefaultLogger replaces default logger with given one.
Types ¶
type Logger ¶
type Logger interface {
// Debug logs debug messages
Debug(v ...interface{})
// Debugf logs formatted debug messages
Debugf(format string, v ...interface{})
// Info lofs info messages
Info(v ...interface{})
// Infof lofs formatted info messages
Infof(format string, v ...interface{})
// Warning logs warning messages
Warning(v ...interface{})
// Warningf logs formatted warning messages
Warningf(format string, v ...interface{})
// Error logs error messages
Error(v ...interface{})
// Errorf logs formatted error messages
Errorf(format string, v ...interface{})
// Fatal logs fatal messages and calls os.Exit(1)
Fatal(v ...interface{})
// Fatalf logs formatted fatal messages and calls os.Exit(1)
Fatalf(format string, v ...interface{})
// SetOutput sets output writer
SetOutput(w io.Writer)
}
Logger is required specification for a logger
Click to show internal directories.
Click to hide internal directories.