Documentation ¶
Index ¶
- Constants
- func Debug(args ...interface{})
- func Debugf(format string, args ...interface{})
- func Error(args ...interface{})
- func Errorf(format string, args ...interface{})
- func Fatal(args ...interface{})
- func Fatalf(format string, args ...interface{})
- func Info(args ...interface{})
- func Infof(format string, args ...interface{})
- func Init(config Config) error
- func Output() io.Writer
- func Panic(args ...interface{})
- func Panicf(format string, args ...interface{})
- func Warn(args ...interface{})
- func Warnf(format string, args ...interface{})
- type Config
- type Fields
- type FileConfig
- type ILogger
- type LoggerFactory
- type LoggerType
- type LogrusLogger
- func (l *LogrusLogger) Debug(args ...interface{})
- func (l *LogrusLogger) Debugf(format string, args ...interface{})
- func (l *LogrusLogger) Error(args ...interface{})
- func (l *LogrusLogger) Errorf(format string, args ...interface{})
- func (l *LogrusLogger) Fatal(args ...interface{})
- func (l *LogrusLogger) Fatalf(format string, args ...interface{})
- func (l *LogrusLogger) Info(args ...interface{})
- func (l *LogrusLogger) Infof(format string, args ...interface{})
- func (l *LogrusLogger) Output() io.Writer
- func (l *LogrusLogger) Panic(args ...interface{})
- func (l *LogrusLogger) Panicf(format string, args ...interface{})
- func (l *LogrusLogger) Warn(args ...interface{})
- func (l *LogrusLogger) Warnf(format string, args ...interface{})
- func (l *LogrusLogger) WithError(err error) ILogger
- func (l *LogrusLogger) WithField(key string, value interface{}) ILogger
- func (l *LogrusLogger) WithFields(fields Fields) ILogger
- func (l *LogrusLogger) WithKVs(kvs ...interface{}) ILogger
- type Option
- type ZapLogger
- func (l *ZapLogger) Debug(args ...interface{})
- func (l *ZapLogger) Debugf(format string, args ...interface{})
- func (l *ZapLogger) Error(args ...interface{})
- func (l *ZapLogger) Errorf(format string, args ...interface{})
- func (l *ZapLogger) Fatal(args ...interface{})
- func (l *ZapLogger) Fatalf(format string, args ...interface{})
- func (l *ZapLogger) Info(args ...interface{})
- func (l *ZapLogger) Infof(format string, args ...interface{})
- func (l *ZapLogger) Output() io.Writer
- func (l *ZapLogger) Panic(args ...interface{})
- func (l *ZapLogger) Panicf(format string, args ...interface{})
- func (l *ZapLogger) Warn(args ...interface{})
- func (l *ZapLogger) Warnf(format string, args ...interface{})
- func (l *ZapLogger) WithError(err error) ILogger
- func (l *ZapLogger) WithField(key string, value interface{}) ILogger
- func (l *ZapLogger) WithFields(fields Fields) ILogger
- func (l *ZapLogger) WithKVs(kvs ...interface{}) ILogger
Constants ¶
View Source
const ( FileRotateByTime = "time" FileRotateBySize = "size" FileRotateByMix = "mix" )
View Source
const ( //DebugLevel has verbose message DebugLevel = "debug" //InfoLevel is default log level InfoLevel = "info" //WarnLevel is for logging messages about possible issues WarnLevel = "warn" //ErrorLevel is for logging errors ErrorLevel = "error" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { Level string DisableConsole bool JsonFormat bool File FileConfig }
type FileConfig ¶
type FileConfig struct { Enable bool Filename string RotateType string // the type of rotation, support time and size RotateTimeS int // the number of seconds between rotation RotateSize int // the maximum size in megabytes of the log file before it gets rotated RotateCount int // the maximum number of log files to retain RotateMaxAge int // the maximum number of days to retain }
type ILogger ¶
type ILogger interface { Debug(args ...interface{}) Debugf(format string, args ...interface{}) Info(args ...interface{}) Infof(format string, args ...interface{}) Warn(args ...interface{}) Warnf(format string, args ...interface{}) Error(args ...interface{}) Errorf(format string, args ...interface{}) Panic(args ...interface{}) Panicf(format string, args ...interface{}) Fatal(args ...interface{}) Fatalf(format string, args ...interface{}) WithFields(fields Fields) ILogger WithField(key string, value interface{}) ILogger WithKVs(kvs ...interface{}) ILogger WithError(err error) ILogger Output() io.Writer }
func WithFields ¶
type LoggerFactory ¶
type LoggerFactory struct { }
func NewLoggerFactory ¶
func NewLoggerFactory() *LoggerFactory
func (*LoggerFactory) Create ¶
func (f *LoggerFactory) Create(t LoggerType, opt *Option) ILogger
type LogrusLogger ¶
type LogrusLogger struct {
// contains filtered or unexported fields
}
func NewLogrusLogger ¶
func NewLogrusLogger(opt *Option) *LogrusLogger
func (*LogrusLogger) Debug ¶
func (l *LogrusLogger) Debug(args ...interface{})
func (*LogrusLogger) Debugf ¶
func (l *LogrusLogger) Debugf(format string, args ...interface{})
func (*LogrusLogger) Error ¶
func (l *LogrusLogger) Error(args ...interface{})
func (*LogrusLogger) Errorf ¶
func (l *LogrusLogger) Errorf(format string, args ...interface{})
func (*LogrusLogger) Fatal ¶
func (l *LogrusLogger) Fatal(args ...interface{})
func (*LogrusLogger) Fatalf ¶
func (l *LogrusLogger) Fatalf(format string, args ...interface{})
func (*LogrusLogger) Info ¶
func (l *LogrusLogger) Info(args ...interface{})
func (*LogrusLogger) Infof ¶
func (l *LogrusLogger) Infof(format string, args ...interface{})
func (*LogrusLogger) Output ¶
func (l *LogrusLogger) Output() io.Writer
func (*LogrusLogger) Panic ¶
func (l *LogrusLogger) Panic(args ...interface{})
func (*LogrusLogger) Panicf ¶
func (l *LogrusLogger) Panicf(format string, args ...interface{})
func (*LogrusLogger) Warn ¶
func (l *LogrusLogger) Warn(args ...interface{})
func (*LogrusLogger) Warnf ¶
func (l *LogrusLogger) Warnf(format string, args ...interface{})
func (*LogrusLogger) WithError ¶
func (l *LogrusLogger) WithError(err error) ILogger
func (*LogrusLogger) WithField ¶
func (l *LogrusLogger) WithField(key string, value interface{}) ILogger
func (*LogrusLogger) WithFields ¶
func (l *LogrusLogger) WithFields(fields Fields) ILogger
func (*LogrusLogger) WithKVs ¶
func (l *LogrusLogger) WithKVs(kvs ...interface{}) ILogger
type Option ¶
type Option struct {
// contains filtered or unexported fields
}
func (*Option) AddCallerSkip ¶
func (*Option) SetJsonFormat ¶
func (*Option) SetTextFormat ¶
type ZapLogger ¶
type ZapLogger struct {
// contains filtered or unexported fields
}
func NewZapLogger ¶
func (*ZapLogger) WithFields ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.