Documentation ¶
Index ¶
- Variables
- func ChangeLogLevel(minLevel string)
- func DefaultRoute() (ip net.IP, err error)
- func GetEtcdClient(c *EtcdConfig) (*etcd.Client, error)
- func InitLogger(minLevel string)
- func InitLoggerCli(c *cli.Context)
- func NewLogger(level string) *log.Logger
- func Render(w http.ResponseWriter, req *http.Request, status int, data interface{})
- func RenderPB(w http.ResponseWriter, status int, msg proto.Message)
- func Round(val float64) float64
- type EtcdConfig
- type HealthData
- type StatsData
Constants ¶
This section is empty.
Variables ¶
var ( // EtcdFlags is a convenience variable for simple etcd cli arguments EtcdFlags = []cli.Flag{ cli.StringSliceFlag{ Name: "peers, C", EnvVar: "ETCD_PEERS", Value: &cli.StringSlice{}, Usage: "a machine address in the etcd cluster (default: \"127.0.0.1:4001\"), may be specified multiple times", }, cli.StringFlag{ Name: "ca-file", EnvVar: "ETCD_CA_FILE", Usage: "etcd certificate authority file", }, cli.StringFlag{ Name: "cert-file", EnvVar: "ETCD_CERT_FILE", Usage: "etcd tls client certificate file", }, cli.StringFlag{ Name: "key-file", EnvVar: "ETCD_KEY_FILE", Usage: "etcd tls client key file", }, cli.BoolFlag{ Name: "no-sync", EnvVar: "ETCD_NO_SYNC", Usage: "don't synchronize etcd cluster information before watching", }, cli.BoolFlag{ Name: "use-default-gateway, d", EnvVar: "ETCD_USE_DEFAULT_GATEWAY", Usage: "expose the default gateway as $ETCD_DEFAULT_GATEWAY", }, } )
var ( // LogLevelFlag is a convenience variable for a simple log-level cli argument LogLevelFlag = cli.StringFlag{ Name: "log-level, l", EnvVar: "LOG_LEVEL", Value: "WARN", Usage: "set log level (DEBUG, INFO, WARN, ERR)", } )
Functions ¶
func ChangeLogLevel ¶ added in v0.2.0
func ChangeLogLevel(minLevel string)
ChangeLogLevel updates the minimum log level
func DefaultRoute ¶ added in v0.2.1
DefaultRoute will read /proc/net/route and look for an IPv4 default gateway. IPv6 gateways will not be found. It will then return the gateway as an IP.
func GetEtcdClient ¶ added in v0.2.0
func GetEtcdClient(c *EtcdConfig) (*etcd.Client, error)
GetEtcdClient returns an etcd Client. Uses endpoints.
func InitLogger ¶
func InitLogger(minLevel string)
InitLogger should be called once at the start of each application to enable the output log filtering. It depends on a cli context GlobalString "log-level" to set the MinLevel.
func InitLoggerCli ¶ added in v0.1.0
InitLoggerCli should be called once at the start of each application to enable the output log filtering. It depends on a cli context GlobalString "log-level" to set the MinLevel.
func NewLogger ¶ added in v0.1.0
NewLogger returns a pointer to an object that implements the log.Logger interface but otherwise works the same as the standard logger.
func Render ¶
func Render(w http.ResponseWriter, req *http.Request, status int, data interface{})
Render looks for a ".pb" extension and renders either the protobuf or JSON message properly to an http.ResponseWriter
Types ¶
type EtcdConfig ¶ added in v0.2.0
EtcdConfig includes a peers list and any TLS info.
func NewEtcdConfig ¶ added in v0.2.0
func NewEtcdConfig(c *cli.Context) *EtcdConfig
NewEtcdConfig creates an etcdConfig declaration from the command line context provided by cli. This includes potential TLS files.
type HealthData ¶ added in v0.1.0
HealthData is used for /health endpoints