Documentation ¶
Index ¶
- Constants
- func Debugf(format string, args ...interface{})
- func Errorf(format string, args ...interface{})
- func Fatalf(format string, args ...interface{})
- func Infof(format string, args ...interface{})
- func NewLogger(config Configuration, loggerInstance int) error
- func Panicf(format string, args ...interface{})
- func Warnf(format string, args ...interface{})
- type Config
- type Configuration
- type Fields
- type Logger
Constants ¶
View Source
const ( //Debug has verbose message Debug = "debug" //Info is default log level Info = "info" //Warn is for logging messages about possible issues Warn = "warn" //Error is for logging errors Error = "error" //Fatal is for logging fatal messages. The sytem shutsdown after logging the message. Fatal = "fatal" )
View Source
const ( //InstanceZapLogger is an instance of the zap logger InstanceZapLogger int = iota //InstanceLogrusLogger is an instance of the logrus logger InstanceLogrusLogger int = 2 )
Variables ¶
This section is empty.
Functions ¶
func Debugf ¶
func Debugf(format string, args ...interface{})
Debugf is the debug level logger instance
func Errorf ¶
func Errorf(format string, args ...interface{})
Errorf is the error level logger instance
func Fatalf ¶
func Fatalf(format string, args ...interface{})
Fatalf is the fatal level logger instance
func NewLogger ¶
func NewLogger(config Configuration, loggerInstance int) error
NewLogger returns an instance of logger
Types ¶
type Config ¶
type Config struct { LogConfig struct { EnableConsole bool `json:"enableConsole"` ConsoleLevel string `json:"consoleLevel"` ConsoleJSONFormat bool `json:"consoleJSONformat"` EnableFile bool `json:"enableFile"` FileLevel string `json:"fileLevel"` FileJSONFormat bool `json:"fileJSONformat"` FileLocation string `json:"fileLocation"` MaxSize int `json:"maxSize"` //MB Compress bool `json:"compress"` MaxAge int `json:"maxAge"` //Days } `json:"logconfig"` }
Config defines the struct for the application configuration
func LoadConfiguration ¶
LoadConfiguration loads the configuration for the application
type Configuration ¶
type Configuration struct { EnableConsole bool `json:"enableConsole"` ConsoleLevel string `json:"consoleLevel"` ConsoleJSONFormat bool `json:"consoleJSONformat"` EnableFile bool `json:"enableFile"` FileLevel string `json:"fileLevel"` FileJSONFormat bool `json:"fileJSONformat"` FileLocation string `json:"fileLocation"` MaxSize int `json:"maxSize"` Compress bool `json:"compress"` MaxAge int `json:"maxAge"` }
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 { Debugf(format string, args ...interface{}) Infof(format string, args ...interface{}) Warnf(format string, args ...interface{}) Errorf(format string, args ...interface{}) Fatalf(format string, args ...interface{}) Panicf(format string, args ...interface{}) WithFields(keyValues Fields) Logger }
Logger is our contract for the logger
func WithFields ¶
WithFields allows the creation of custom fields as key value pairs.
Click to show internal directories.
Click to hide internal directories.