pretty

package
v3.9.0-alpha.1+incompa... Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2017 License: Apache-2.0, Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClusterServiceBrokerName

func ClusterServiceBrokerName(brokerName string) string

ClusterServiceBrokerName returns a string with the type and name of a broker

func ClusterServiceClassName

func ClusterServiceClassName(serviceClass *v1beta1.ClusterServiceClass) string

ClusterServiceClassName returns a string with the k8s name and external name if available.

func ClusterServicePlanName

func ClusterServicePlanName(servicePlan *v1beta1.ClusterServicePlan) string

ClusterServicePlanName returns a string with the k8s name and external name if available.

func FromServiceInstanceOfClusterServiceClassAtBrokerName

func FromServiceInstanceOfClusterServiceClassAtBrokerName(instance *v1beta1.ServiceInstance, serviceClass *v1beta1.ClusterServiceClass, brokerName string) string

FromServiceInstanceOfClusterServiceClassAtBrokerName returns a string in the form of "%s of %s at %s" to help in logging the full context.

func Name

func Name(kind Kind, k8sName, externalName string) string

Name prints in the form `<Kind> (K8S: <K8S-Name> ExternalName: <External-Name>)` kind is required. k8sName and externalName are optional

func ServiceInstanceName

func ServiceInstanceName(instance *v1beta1.ServiceInstance) string

ServiceInstanceName returns a string with the type, namespace and name of an instance.

Types

type ContextBuilder

type ContextBuilder struct {
	Kind      Kind
	Namespace string
	Name      string
}

ContextBuilder allows building up pretty message lines with context that is important for debugging and tracing. This class helps create log line formatting consistency. Pretty lines should be in the form: <Kind> "<Namespace>/<Name>": <message>

func NewContextBuilder

func NewContextBuilder(kind Kind, namespace string, name string) *ContextBuilder

NewContextBuilder returns a new ContextBuilder that can be used to format messages in the form `<Kind> "<Namespace>/<Name>": <message>`. kind, namespace, name are all optional.

func (*ContextBuilder) Message

func (pcb *ContextBuilder) Message(msg string) string

Message returns a string with message prepended with the current source context.

func (*ContextBuilder) Messagef

func (pcb *ContextBuilder) Messagef(format string, a ...interface{}) string

Messagef returns a string with message formatted then prepended with the current source context.

func (*ContextBuilder) SetKind

func (pcb *ContextBuilder) SetKind(k Kind) *ContextBuilder

SetKind sets the kind to use in the source context for messages.

func (*ContextBuilder) SetName

func (pcb *ContextBuilder) SetName(n string) *ContextBuilder

SetName sets the name to use in the source context for messages.

func (*ContextBuilder) SetNamespace

func (pcb *ContextBuilder) SetNamespace(n string) *ContextBuilder

SetNamespace sets the namespace to use in the source context for messages.

func (ContextBuilder) String

func (pcb ContextBuilder) String() string

type Kind

type Kind int

Kind is used for the enum of the Type of object we are building context for.

const (
	Unknown Kind = iota
	ClusterServiceBroker
	ClusterServiceClass
	ClusterServicePlan
	ServiceBinding
	ServiceInstance
)

Names of Types to use when creating pretty messages

func (Kind) String

func (k Kind) String() string

Jump to

Keyboard shortcuts

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