Documentation ¶
Index ¶
- Variables
- func AtLevel(level zapcore.Level, msg string, fields ...zapcore.Field)
- func Configure(config Config)
- func Debug(msg string, fields ...zapcore.Field)
- func Error(msg string, fields ...zapcore.Field)
- func Fatal(msg string, fields ...zapcore.Field)
- func Info(msg string, fields ...zapcore.Field)
- func Panic(msg string, fields ...zapcore.Field)
- func Sugar() *zap.SugaredLogger
- func Warn(msg string, fields ...zapcore.Field)
- type Config
Constants ¶
This section is empty.
Variables ¶
var DefaultZapLogger = newZapLogger(false, os.Stdout)
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())
Functions ¶
func Configure ¶
func Configure(config Config)
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/auth-service/auth-service.log and will be rolled when it reaches 20MB with a maximum of 1 backup.
func Debug ¶
Debug Log a message at the debug level. Messages include any context that's accumulated on the logger, as well as any fields added at the log site.
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 Error ¶
Error Log a message at the error level. Messages include any context that's accumulated on the logger, as well as any fields added at the log site.
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 Fatal ¶
Fatal Log a message at the fatal level. Messages include any context that's accumulated on the logger, as well as any fields added at the log site.
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 Info ¶
Info log a message at the info level. Messages include any context that's accumulated on the logger, as well as any fields added at the log site.
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 Panic ¶
Panic Log a message at the Panic level. Messages include any context that's accumulated on the logger, as well as any fields added at the log site.
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 Warn ¶
Warn log a message at the warn level. Messages include any context that's accumulated on the logger, as well as any fields added at the log site.
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!
Types ¶
type Config ¶
type Config struct { // EncodeLogsAsJson makes the log framework log JSON EncodeLogsAsJson bool // FileLoggingEnabled makes the framework log to a file // the fields below can be skipped if this value is false! FileLoggingEnabled 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 }
Config Configuration for logging