common

package
v0.0.0-...-200a656 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 11, 2019 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultTimeout default max cli execution time
	DefaultTimeout = 5 * time.Second // seconds
)

Variables

View Source
var (
	// MapStringToLevel trans string to logs level enum
	MapStringToLevel = map[string]int{
		"EMERGENCY": logs.LevelEmergency,
		"ALERT":     logs.LevelAlert,
		"CRITICAL":  logs.LevelCritical,
		"ERROR":     logs.LevelError,
		"WARNING":   logs.LevelWarning,
		"NOTICE":    logs.LevelNotice,
		"INFO":      logs.LevelInformational,
		"DEBUG":     logs.LevelDebug,
	}
)

Functions

This section is empty.

Types

type AppConfig

type AppConfig struct {
	LogCfg *LogConfig
	SrvCfg *ServerConfig
}

AppConfig app configurations

var AppConfigInstance *AppConfig

AppConfigInstance ...

type LogConfig

type LogConfig struct {
	Adaptor  string `json:"adaptor"`
	Filepath string `json:"filepath"`
	Level    string `json:"level"`
	MaxSize  int    `json:"maxsize"`
}

LogConfig is the config struct for rrframework/logs

type Message

type Message struct {
	Text          string                 // Delimited log line
	Parsed        map[string]interface{} // If non-nil, contains parsed fields
	ReceptionTime time.Time              // Time log line was received
	SourceIP      string                 // Sender's IP address
}

Message is a log message, with a reception timestamp and sequence number.

func NewMessage

func NewMessage() *Message

NewMessage returns a new Message.

type ServerConfig

type ServerConfig struct {
	TCPAddr string // listen ip
	UDPAddr string
	RFC3164 string // port num for syslog format RFC3164
	RFC5424 string //
	Unknown string
	Filters []string
}

ServerConfig syslog server configuration

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL