Documentation ¶
Index ¶
- Constants
- func CheckFileAndCreate(path string) (err error)
- func NewSlsLogFormPrint(logLevel string, args ...interface{})
- func NewSlsLogFormPrintf(logLevel, template string, args ...interface{})
- type Config
- func (c *Config) DisableFileOut()
- func (c *Config) EnableFileOut()
- func (c *Config) SetColorful(colorful bool)
- func (c *Config) SetConsoleOut(consoleOut bool)
- func (c *Config) SetEnvMode(envMode string)
- func (c *Config) SetFileOut(path string, maxAge, rotationTime uint)
- func (c *Config) SetJsonFormat(jsonFormat bool)
- func (c *Config) SetLevel(level Level)
- func (c *Config) SetName(name string)
- func (c *Config) SetSkip(skip int)
- type Level
- type LogKafka
- type Logger
- func (l *Logger) Debug(args ...interface{})
- func (l *Logger) Debugf(template string, args ...interface{})
- func (l *Logger) Error(args ...interface{})
- func (l *Logger) Errorf(template string, args ...interface{})
- func (l *Logger) Fatal(args ...interface{})
- func (l *Logger) Fatalf(template string, args ...interface{})
- func (l *Logger) Info(args ...interface{})
- func (l *Logger) Infof(template string, args ...interface{})
- func (l *Logger) Panic(args ...interface{})
- func (l *Logger) Panicf(template string, args ...interface{})
- func (l *Logger) Warn(args ...interface{})
- func (l *Logger) Warnf(template string, args ...interface{})
- func (l *Logger) With(args ...interface{}) *Logger
- func (l *Logger) WithConfig(isDebug bool, kafkaSwitch bool)
Constants ¶
View Source
const ( Reset = "\033[0m" Red = "\033[31m" Green = "\033[32m" Yellow = "\033[33m" Blue = "\033[34m" Magenta = "\033[35m" Cyan = "\033[36m" White = "\033[37m" BlueBold = "\033[34;1m" MagentaBold = "\033[35;1m" RedBold = "\033[31;1m" YellowBold = "\033[33;1m" )
Colors
Variables ¶
This section is empty.
Functions ¶
func NewSlsLogFormPrint ¶
func NewSlsLogFormPrint(logLevel string, args ...interface{})
func NewSlsLogFormPrintf ¶
func NewSlsLogFormPrintf(logLevel, template string, args ...interface{})
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config 日志配置
func DebugConfig ¶
func DebugConfig() *Config
func (*Config) DisableFileOut ¶
func (c *Config) DisableFileOut()
func (*Config) EnableFileOut ¶
func (c *Config) EnableFileOut()
func (*Config) SetColorful ¶
func (*Config) SetConsoleOut ¶
func (*Config) SetEnvMode ¶
func (*Config) SetFileOut ¶
设置 文件输出
func (*Config) SetJsonFormat ¶
type LogKafka ¶ added in v1.3.12
type LogKafka struct { Topic string Producer sarama.SyncProducer Partition int32 }
type Logger ¶
type Logger struct { Config *Config // contains filtered or unexported fields }
func (*Logger) With ¶
With adds a variadic number of fields to the logging context. see https://github.com/uber-go/zap/blob/v1.10.0/sugar.go#L91
func (*Logger) WithConfig ¶
根据配置文件更新 logger
Click to show internal directories.
Click to hide internal directories.