Documentation
¶
Index ¶
- Constants
- type Logger
- func (l *Logger) Debugf(message string, other ...interface{})
- func (l *Logger) Debugln(message string)
- func (l *Logger) Errorf(message string, other ...interface{})
- func (l *Logger) Errorln(message string)
- func (l *Logger) Fatalf(message string, other ...interface{})
- func (l *Logger) Fatalln(message string)
- func (l *Logger) Infof(message string, other ...interface{})
- func (l *Logger) Infoln(message string)
- func (l *Logger) NewModule(prefix string) *Logger
- func (l *Logger) Tracef(message string, other ...interface{})
- func (l *Logger) Traceln(message string)
- func (l *Logger) Warnf(message string, other ...interface{})
- func (l *Logger) Warnln(message string)
- type LoggerConfig
- type Stats
- type StatsConfig
- type StatsServer
- type StatsServerConfig
Constants ¶
const ( LogOff int = 0 LogFatal int = 1 LogError int = 2 LogWarn int = 3 LogInfo int = 4 LogDebug int = 5 LogTrace int = 6 LogAll int = 7 )
Logger level constants
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger - A logger object with support for levelled logging and modular components.
func NewLogger ¶
func NewLogger(stream io.Writer, config LoggerConfig) *Logger
NewLogger - Create and return a new logger object.
func (*Logger) NewModule ¶
NewModule - Creates a new logger object from the previous, using the same configuration, but adds an extra prefix to represent a submodule.
type LoggerConfig ¶
type LoggerConfig struct {
Prefix string `json:"prefix"`
LogLevel string `json:"log_level"`
AddTimeStamp bool `json:"add_timestamp"`
}
LoggerConfig - Holds configuration options for a logger object.
func DefaultLoggerConfig ¶
func DefaultLoggerConfig() LoggerConfig
DefaultLoggerConfig - Returns a fully defined logger configuration with the default values for each field.
type Stats ¶
type Stats struct {
// contains filtered or unexported fields
}
Stats - A stats object with capability to hold internal stats as a JSON endpoint, push to statsd, or both.
func NewStats ¶
func NewStats(config StatsConfig) *Stats
NewStats - Create and return a new stats object.
func (*Stats) Close ¶
func (s *Stats) Close()
Close - Stops the stats object from accepting stats and pushing stats to a configured statsd service.
func (*Stats) GetStats ¶
GetStats - Returns a string containing the JSON serialized structure of stats at the time of the request.
type StatsConfig ¶
type StatsConfig struct {
JobBuffer int64 `json:"job_buffer"`
RootPath string `json:"prefix"`
RetainInternal bool `json:"retain_internal"`
StatsDAddress string `json:"statsd_address"`
}
StatsConfig - Holds configuration options for a stats object.
func DefaultStatsConfig ¶
func DefaultStatsConfig() StatsConfig
DefaultStatsConfig - Returns a fully defined stats configuration with the default values for each field.
type StatsServer ¶
type StatsServer struct {
// contains filtered or unexported fields
}
StatsServer - A server constructed to present an HTTP endpoint for obtaining live statics regarding the leaps server. Requires a reference to the logger shared with the Curator object at the center of the service.
func NewStatsServer ¶
func NewStatsServer(config StatsServerConfig, logger *Logger, stats *Stats) (*StatsServer, error)
NewStatsServer - Create a new leaps StatsServer.
func (*StatsServer) Listen ¶
func (s *StatsServer) Listen() error
Listen - Bind to the configured http endpoint and begin serving requests.
func (*StatsServer) ServeHTTP ¶
func (s *StatsServer) ServeHTTP(w http.ResponseWriter, r *http.Request)
StatsHandler - The StatsServer request handler.
type StatsServerConfig ¶
type StatsServerConfig struct {
StaticPath string `json:"static_path"`
Path string `json:"stats_path"`
Address string `json:"address"`
StaticFilePath string `json:"www_dir"`
StatsTimeout int `json:"stat_timeout_ms"`
RequestTimeout int `json:"request_timeout_s"`
}
StatsServerConfig - Holds configuration options for the StatsServer
func DefaultStatsServerConfig ¶
func DefaultStatsServerConfig() StatsServerConfig
DefaultStatsServerConfig - Returns a fully defined StatsServer configuration with the default values for each field.