Documentation ¶
Index ¶
- func Debug(msg string)
- func Debugf(format string, args ...interface{})
- func Error(msg string)
- func Errorf(format string, args ...interface{})
- func Fatal(msg string)
- func Fatalf(format string, args ...interface{})
- func GetDelegate() interface{}
- func GetDesugaredZapLoggerDelegate(instance Logger) (*zap.Logger, error)
- func GetZapLoggerDelegate(instance Logger) (*zap.SugaredLogger, error)
- func Info(msg string)
- func Infof(format string, args ...interface{})
- func Panic(msg string)
- func Panicf(format string, args ...interface{})
- func Sync() error
- func Warn(msg string)
- func Warnf(format string, args ...interface{})
- type Configuration
- type Fields
- type Logger
- type LoggerBackend
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetDelegate ¶
func GetDelegate() interface{}
func GetZapLoggerDelegate ¶
func GetZapLoggerDelegate(instance Logger) (*zap.SugaredLogger, error)
Types ¶
type Configuration ¶
type Configuration struct { EnableConsole bool `` /* 143-byte string literal not displayed */ ConsoleJSONFormat bool `` /* 166-byte string literal not displayed */ ConsoleLevel string `` /* 184-byte string literal not displayed */ EnableFile bool FileJSONFormat bool FileLevel string FileLocation string }
Configuration stores the config for the logger For some loggers there can only be one level across writers, for such the level of Console is picked by default
type Fields ¶
type Fields map[string]interface{}
Fields Type to pass when we want to call WithFields for structured logging
type Logger ¶
type Logger interface { Debug(msg string) Debugf(format string, args ...interface{}) Info(msg string) Infof(format string, args ...interface{}) Warn(msg string) Warnf(format string, args ...interface{}) Error(msg string) Errorf(format string, args ...interface{}) Fatal(msg string) Fatalf(format string, args ...interface{}) Panic(msg string) Panicf(format string, args ...interface{}) WithFields(keyValues Fields) Logger GetDelegate() interface{} Sync() error }
Logger is our contract for the logger
func DefaultLogger ¶
func DefaultLogger() Logger
DefaultLogger creates default logger, which uses zap sugarlogger and outputs to console
func InitLogger ¶
func InitLogger(config Configuration, backend LoggerBackend) (Logger, error)
InitLogger returns an instance of logger
func NewLogger ¶
func NewLogger(config Configuration, backend LoggerBackend) (Logger, error)
func WithFields ¶
type LoggerBackend ¶
type LoggerBackend int
LoggerBackend reprents the int enum for backend of logger (exists for legacy compat reason) nolint:revive
const ( // LoggerBackendZap logging using Uber's zap backend LoggerBackendZap LoggerBackend = iota // LoggerBackendLogrus logging using logrus backend LoggerBackendLogrus )
Click to show internal directories.
Click to hide internal directories.