Documentation ¶
Index ¶
- Variables
- func InitGlobalLogger(config *Config)
- type Config
- type Logger
- func (l *Logger) Debug(msg string, fields ...zapcore.Field)
- func (l *Logger) Debugf(msg string, keysAndValues ...interface{})
- func (l *Logger) Error(msg string, fields ...zapcore.Field)
- func (l *Logger) Errorf(msg string, keysAndValues ...interface{})
- func (l *Logger) Fatal(msg string, fields ...zapcore.Field)
- func (l *Logger) Fatalf(msg string, keysAndValues ...interface{})
- func (l *Logger) Info(msg string, fields ...zapcore.Field)
- func (l *Logger) Infof(msg string, keysAndValues ...interface{})
- func (l *Logger) Warn(msg string, fields ...zapcore.Field)
- func (l *Logger) Warnf(msg string, keysAndValues ...interface{})
Constants ¶
This section is empty.
Variables ¶
var ( // Int constructs a field with the given key and value. Int = zap.Int // String constructs a field with the given key and value. String = zap.String // Debug logs a message at DebugLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger. Debug func(msg string, fields ...zapcore.Field) // Info logs a message at InfoLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger. Info func(msg string, fields ...zapcore.Field) // Warn logs a message at WarnLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger. Warn func(msg string, fields ...zapcore.Field) // Error logs a message at ErrorLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger. Error func(msg string, fields ...zapcore.Field) // Fatal logs a message at FatalLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger. Fatal func(msg string, fields ...zapcore.Field) // Debugf logs a message at DebugLevel. This message corresponds to the format string. Debugf func(format string, values ...interface{}) // Infof logs a message at InfoLevel. This message corresponds to the format string. Infof func(format string, values ...interface{}) // Warnf logs a message at WarnLevel. This message corresponds to the format string. Warnf func(format string, values ...interface{}) // Errorf logs a message at ErrorLevel. This message corresponds to the format string. Errorf func(format string, values ...interface{}) // Fatalf logs a message at FatalLevel. This message corresponds to the format string. Fatalf func(format string, values ...interface{}) )
Functions ¶
func InitGlobalLogger ¶
func InitGlobalLogger(config *Config)
InitGlobalLogger initialize global logger
Types ¶
type Config ¶
type Config struct { // EnableConsole is a flag for enable console log. EnableConsole bool // ConsoleFormat is a format for console log. ConsoleFormat string // ConsoleLevel is a level for console log. ConsoleLevel string // EnableFile is a flag for enable file log. EnableFile bool // FileFormat is a format for file log. FileFormat string // FileLevel is a log level for file log. FileLevel string // FilePath is a file path for file log. FilePath string // FileMaxSize is a max size(megabytes) for file log. The Default is 100 megabytes. FileMaxSize int // FileMaxAge is a max age(days) for file log. The default is not to remove old log files. FileMaxAge int // FileMaxBackups is a max backup file number for file log. The default is to retain all old log files FileMaxBackups int // FileLocalTime is a formatting the timestamps for backup files. The default is to use UTC time. FileLocalTime bool // FileCompress is a compressed flag for file log. The default is false. FileCompress bool }
Config is settings of logger
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger is struct for logging.
func (*Logger) Debug ¶
Debug logs a message at DebugLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.
func (*Logger) Debugf ¶
Debugw logs a message at DebugLevel by SugardLogger. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.
func (*Logger) Error ¶
Error logs a message at ErrorLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.
func (*Logger) Errorf ¶
Errorw logs a message at ErrorLevel by SugardLogger. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.
func (*Logger) Fatal ¶
Fatal logs a message at FatalLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.
func (*Logger) Fatalf ¶
Fatalw logs a message at FatalLevel by SugardLogger. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.
func (*Logger) Info ¶
Info logs a message at InfoLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.
func (*Logger) Infof ¶
Infow logs a message at InfoLevel by SugardLogger. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.