util

package
v1.7.3 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2021 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// Colorize enables colors support.
	Colorize = true
)

Functions

func ExitWithError

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

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

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

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

func LoadConfig

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

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

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

func (*ConfigWrapper) Unmarshal

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