util

package
v1.9.2 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2021 License: MIT Imports: 19 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// Colorize enables colors support.
	Colorize = true
)

Functions

func ExitWithError added in v1.4.3

func ExitWithError(err error)

ExitWithError prints error and exits with error code`.

func LogEvent

func LogEvent(logger *logrus.Logger, event int, ctx interface{}) bool

LogEvent outputs rr event into given logger and return false if event was not handled.

func Panicf added in v1.4.3

func Panicf(format string, args ...interface{}) error

Panicf prints `<white+hb>color formatted message to STDERR</reset>`.

func Printf

func Printf(format string, args ...interface{})

Printf works identically to fmt.Print but adds `<white+hb>color formatting support for CLI</reset>`.

func RPCClient

func RPCClient(container service.Container) (*rpc.Client, error)

RPCClient returns RPC client associated with given rr service container.

func Sprintf

func Sprintf(format string, args ...interface{}) string

Sprintf works identically to fmt.Sprintf but adds `<white+hb>color formatting support for CLI</reset>`.

func WorkerTable

func WorkerTable(workers []*rrutil.State) *tablewriter.Table

WorkerTable renders table with information about rr server workers.

Types

type ConfigWrapper added in v1.4.8

type ConfigWrapper struct {
	// contains filtered or unexported fields
}

ConfigWrapper provides interface bridge between v configs and service.Config.

func LoadConfig added in v1.3.0

func LoadConfig(cfgFile string, path []string, name string, flags []string, jsonConfig string) (*ConfigWrapper, error)

LoadConfig config and merge it's values with set of flags.

func (*ConfigWrapper) Get added in v1.4.8

func (w *ConfigWrapper) Get(key string) service.Config

Get nested config section (sub-map), returns nil if section not found.

func (*ConfigWrapper) Unmarshal added in v1.4.8

func (w *ConfigWrapper) Unmarshal(out interface{}) error

Unmarshal unmarshal config data into given struct.

Jump to

Keyboard shortcuts

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