Documentation
¶
Index ¶
- func GetPathSymbol() string
- type LogLevel
- type Logger
- func (l *Logger) Debug(args ...interface{})
- func (l *Logger) Error(args ...interface{})
- func (l *Logger) Fatal(args ...interface{})
- func (l *Logger) GetFormatter() string
- func (l *Logger) GetLevel() string
- func (l *Logger) GetLogger() *logrus.Logger
- func (l *Logger) Info(args ...interface{})
- func (l *Logger) Panic(args ...interface{})
- func (l *Logger) SetFormatter(format string)
- func (l *Logger) SetLevel(level string)
- func (l *Logger) SetOutput(config *viper.Viper)
- func (l *Logger) Warn(args ...interface{})
- type LoggerInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetPathSymbol ¶ added in v1.0.2
func GetPathSymbol() string
Types ¶
type Logger ¶
type Logger struct {
Level string `yaml:"level"` //等級(有 debug、info、error、fatal 與 panic)
Format string `yaml:"format"` //格式(有 json 或 text)
// contains filtered or unexported fields
}
log 物件
func InterfaceToLogger ¶
func InterfaceToLogger(data interface{}) Logger
func (*Logger) GetFormatter ¶
func (*Logger) SetFormatter ¶
type LoggerInterface ¶
type LoggerInterface interface {
//GetLogger : 取得 Logger
GetLogger() *logrus.Logger
//設定 log 等級
SetLevel(level string)
//取得 log 等級
GetLevel() string
//設定 output
SetOutput(config *viper.Viper)
//取得 log 輸出格式
GetFormatter() string
//設定 log 輸出格式
SetFormatter(format string)
// 輸出 debug 等級 log
Debug(args ...interface{})
// 輸出 info 等級 log
Info(args ...interface{})
// 輸出 warn 等級 log
Warn(args ...interface{})
// 輸出 error 等級 log
Error(args ...interface{})
// 輸出 fatal 等級 log
Fatal(args ...interface{})
// 輸出 panic 等級 log
Panic(args ...interface{})
}
log 介面
var (
Log LoggerInterface
)
func NewLogger ¶
func NewLogger(setting Logger) LoggerInterface
func NewLoggerWithConfiger ¶ added in v1.0.1
func NewLoggerWithConfiger(config *viper.Viper) LoggerInterface
Click to show internal directories.
Click to hide internal directories.