model

package
v0.0.0-...-11464cf Latest Latest
Warning

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

Go to latest
Published: May 9, 2017 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// InboxMinLength is the minimum size (in bytes) of an inbox
	InboxMinLength = 10

	// InboxMaxLength is the maximum size (in bytes) of an inbox
	InboxMaxLength = 20
)

Variables

This section is empty.

Functions

func Between

func Between(min int, max int) int

Between returns a number between min and max inclusively.

func InboxName

func InboxName(length int) (name string, err error)

InboxName generates a cryptographically-secure random string which can be used as an inbox for orchestrators and agents during communication.

func NewLogger

func NewLogger(out io.Writer, level log.Level) (logger *log.Logger)

NewLogger returns a pointer to a new logrus logger with all sensible defaults configured.

func TakeRandom

func TakeRandom(input []string, perc float64) (output []string)

TakeRandom takes a random percentage of strings from a slice of strings, guaranteeing that each item will appear only once.

Types

type ConfigDuration

type ConfigDuration struct {
	time.Duration
}

ConfigDuration allows for the configuration of durations in the form of "5m30s", as opposed to the default Unix epoch timestamp.

func (*ConfigDuration) UnmarshalJSON

func (d *ConfigDuration) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON unmarshals a ConfigDuration from JSON.

type ConfigLogLevel

type ConfigLogLevel struct {
	logrus.Level
}

ConfigLogLevel allows for the configuration of logrus log levels in the form of "debug", as opposed to the default numeric representation

func (*ConfigLogLevel) UnmarshalJSON

func (d *ConfigLogLevel) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON unmarshals a ConfigLogLevel from JSON.

type UTCFormatter

type UTCFormatter struct {
	log.Formatter
}

UTCFormatter formats logrus timestamps in UTC format rather than the default local format.

func (UTCFormatter) Format

func (u UTCFormatter) Format(e *log.Entry) ([]byte, error)

Format takes a local timestamp and converts it to UTC.

Jump to

Keyboard shortcuts

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