Documentation
¶
Index ¶
- Constants
- type Config
- type Level
- type Log
- type Logger
- func (l *Logger) Debug(v ...interface{})
- func (l *Logger) Debugf(format string, v ...interface{})
- func (l *Logger) Error(v ...interface{})
- func (l *Logger) Errorf(format string, v ...interface{})
- func (l *Logger) Fatal(v ...interface{})
- func (l *Logger) Fatalf(format string, v ...interface{})
- func (l *Logger) GetFileLine(n int) (string, int)
- func (l *Logger) GetRef() string
- func (l *Logger) Info(v ...interface{})
- func (l *Logger) Infof(format string, v ...interface{})
- func (l *Logger) Init() error
- func (l *Logger) Log(lg *Log)
- func (l *Logger) LogAPIInfo(r *http.Request, responseTime float64, status int)
- func (l *Logger) PostToRemote(level, msg string)
- func (l *Logger) Warn(v ...interface{})
- func (l *Logger) Warnf(format string, v ...interface{})
Constants ¶
View Source
const ( DEBUG Level = iota + 1 INFO WARN ERROR FATAL Debug = "Debug" Info = "Info" Warn = "Warn" Error = "Error" Fatal = "Fatal" SHORT = iota FULL FilePathShort = "Short" FilePathFull = "Full" )
View Source
const ( DependancyTypeHTTP = "http" DependancyTypeDB = "db" DependancyTypeRedis = "redis" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // The supported log levels are as follows // DEBUG < INFO < WARN < ERROR < FATAL // If a log level is specified all logs with level below the specified level are ignored // Eg. If INFO is selected, All DEBUG logs are ignored // If ERROR is selected all logs except ERROR and FATAL are ignored Level Level // Log levels in string format. // The supported log level strings are Debug, Info, Warn, Error, Fatal // You can specify log level using Level Enum or string // The Enum value is given first preference LevelStr string // Size of the file to be printed, there are two possible values FULL, SHORT // SHORT - Only the file name is displayed // FULL - File name along with full file path is specified // SHORT is used by default FilePathSize int // Log Reference (context) ID to be added to each log // This can be used to search relevent logs for the context Reference string AppName string RemoteLoggerURL string RemoteToken string RemoteUserName string // contains filtered or unexported fields }
func (*Config) SetFilePathSize ¶
func (*Config) SetFilePathSizeStr ¶
func (*Config) SetLevelStr ¶
func (*Config) SetReference ¶
func (*Config) SetRemoteConfig ¶
type Log ¶
type Log struct { Level string `json:"level"` Timestamp time.Time `json:"timestamp"` Title string `json:"message"` Message string `json:"full_message"` AppName string `json:"app_name"` RefID string `json:"ref_id"` File string `json:"file"` Line string `json:"line"` ResponseTime float64 `json:"response_time"` StatusCode int `json:"status_code"` Method string `json:"method"` Request string `json:"request"` UserAgent string `json:"user_agent"` CustomerID string `json:"customer_id"` IPAddress string `json:"ip_address"` RequestGroup string `json:"request_group" example:"Ping"` AppVersion string `json:"app_version" example:"App Version"` TimeTaken float64 `json:"time_taken" example:"1.11"` DependancyType string `json:"dependancy_type" example:"http,database"` DependancyName string `json:"dependancy_name" example:"googleapi,booktripsp"` }
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
func (*Logger) LogAPIInfo ¶
func (*Logger) PostToRemote ¶
Click to show internal directories.
Click to hide internal directories.