Documentation ¶
Index ¶
- func AtLevel(level zapcore.Level, msg string, fields ...zapcore.Field)
- func Debug(msg string, keysAndValues ...interface{})
- func Debugf(template string, args ...interface{})
- func Debugs(args ...interface{})
- func Debugt(msg string, fields ...zapcore.Field)
- func Debugw(msg string, keysAndValues ...interface{})
- func Error(msg string, keysAndValues ...interface{})
- func Errorf(template string, args ...interface{})
- func Errors(args ...interface{})
- func Errort(msg string, fields ...zapcore.Field)
- func Errorw(msg string, keysAndValues ...interface{})
- func Fatal(msg string, keysAndValues ...interface{})
- func Fatalf(template string, args ...interface{})
- func Fatals(args ...interface{})
- func Fatalt(msg string, fields ...zapcore.Field)
- func Fatalw(msg string, keysAndValues ...interface{})
- func Info(msg string, keysAndValues ...interface{})
- func Infof(template string, args ...interface{})
- func Infos(args ...interface{})
- func Infot(msg string, fields ...zapcore.Field)
- func Infow(msg string, keysAndValues ...interface{})
- func Panic(msg string, keysAndValues ...interface{})
- func Panicf(template string, args ...interface{})
- func Panics(args ...interface{})
- func Panict(msg string, fields ...zapcore.Field)
- func Panicw(msg string, keysAndValues ...interface{})
- func Warn(msg string, keysAndValues ...interface{})
- func Warnf(template string, args ...interface{})
- func Warns(args ...interface{})
- func Warnt(msg string, fields ...zapcore.Field)
- func Warnw(msg string, keysAndValues ...interface{})
- type Config
- type Logger
- func (logger *Logger) AtLevel(level zapcore.Level, msg string, fields ...zapcore.Field) *Logger
- func (logger *Logger) Debug(msg string, keysAndValues ...interface{})
- func (logger *Logger) Debugs(args ...interface{})
- func (logger *Logger) Debugt(msg string, fields ...zapcore.Field)
- func (logger *Logger) Error(msg string, keysAndValues ...interface{})
- func (logger *Logger) Errors(args ...interface{})
- func (logger *Logger) Errort(msg string, fields ...zapcore.Field)
- func (logger *Logger) Fatal(msg string, keysAndValues ...interface{})
- func (logger *Logger) Fatals(args ...interface{})
- func (logger *Logger) Fatalt(msg string, fields ...zapcore.Field)
- func (logger *Logger) Info(msg string, keysAndValues ...interface{})
- func (logger *Logger) Infos(args ...interface{})
- func (logger *Logger) Infot(msg string, fields ...zapcore.Field)
- func (logger *Logger) Panic(msg string, keysAndValues ...interface{})
- func (logger *Logger) Panics(args ...interface{})
- func (logger *Logger) Panict(msg string, fields ...zapcore.Field)
- func (logger *Logger) Warn(msg string, keysAndValues ...interface{})
- func (logger *Logger) Warns(args ...interface{})
- func (logger *Logger) Warnt(msg string, fields ...zapcore.Field)
- type LoggerInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { ConsoleEnabled bool ConsoleLevel string ConsoleJson bool FileEnabled bool FileLevel string FileJson bool // Directory to log to to when filelogging is enabled Directory string // Filename is the name of the logfile which will be placed inside the directory Filename string // MaxSize the max size in MB of the logfile before it's rolled MaxSize int // MaxBackups the max number of rolled files to keep MaxBackups int // MaxAge the max age in days to keep a logfile MaxAge int }
Configuration for logging
type Logger ¶
type Logger struct { Unsugared *zap.Logger *zap.SugaredLogger }
var DefaultZapLogger *Logger
DefaultZapLogger is the default logger instance that should be used to log It's assigned a default value here for tests (which do not call log.Configure())
func Configure ¶
Configure sets up the logging framework
In production, the container logs will be collected and file logging should be disabled. However, during development it's nicer to see logs as text and optionally write to a file when debugging problems in the containerized pipeline
The output log file will be located at /var/log/service-xyz/service-xyz.log and will be rolled according to configuration set.
func (*Logger) Debugt ¶
Use zap.String(key, value), zap.Int(key, value) to log fields. These fields will be marshalled as JSON in the logfile and key value pairs in the console!
func (*Logger) Errort ¶
Use zap.String(key, value), zap.Int(key, value) to log fields. These fields will be marshalled as JSON in the logfile and key value pairs in the console!
func (*Logger) Fatalt ¶
Use zap.String(key, value), zap.Int(key, value) to log fields. These fields will be marshalled as JSON in the logfile and key value pairs in the console!
func (*Logger) Infot ¶
Use zap.String(key, value), zap.Int(key, value) to log fields. These fields will be marshalled as JSON in the logfile and key value pairs in the console!
type LoggerInterface ¶
type LoggerInterface interface { Debugt(msg string, fields ...zapcore.Field) Debugf(template string, args ...interface{}) Debugw(msg string, keysAndValues ...interface{}) Debug(msg string, keysAndValues ...interface{}) Debugs(args ...interface{}) Infot(msg string, fields ...zapcore.Field) Infof(template string, args ...interface{}) Infow(msg string, keysAndValues ...interface{}) Info(msg string, keysAndValues ...interface{}) Infos(args ...interface{}) Warnt(msg string, fields ...zapcore.Field) Warnf(template string, args ...interface{}) Warnw(msg string, keysAndValues ...interface{}) Warn(msg string, keysAndValues ...interface{}) Warns(args ...interface{}) Errort(msg string, fields ...zapcore.Field) Errorf(template string, args ...interface{}) Errorw(msg string, keysAndValues ...interface{}) Error(msg string, keysAndValues ...interface{}) Errors(args ...interface{}) Panict(msg string, fields ...zapcore.Field) Panicf(template string, args ...interface{}) Panicw(msg string, keysAndValues ...interface{}) Panic(msg string, keysAndValues ...interface{}) Panics(args ...interface{}) Fatalt(msg string, fields ...zapcore.Field) Fatalf(template string, args ...interface{}) Fatalw(msg string, keysAndValues ...interface{}) Fatal(msg string, keysAndValues ...interface{}) Fatals(args ...interface{}) AtLevel(level zapcore.Level, msg string, fields ...zapcore.Field) *Logger }