pretty

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClusterServiceBrokerName added in v0.1.1

func ClusterServiceBrokerName(clusterServiceBrokerName 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 added in v0.1.1

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 FromServiceInstanceOfServiceClassAtBrokerName added in v0.1.31

func FromServiceInstanceOfServiceClassAtBrokerName(instance *v1beta1.ServiceInstance, serviceClass *v1beta1.ServiceClass, brokerName string) string

FromServiceInstanceOfServiceClassAtBrokerName 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 ServiceBrokerName added in v0.1.31

func ServiceBrokerName(serviceBrokerName string) string

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

func ServiceClassName added in v0.1.31

func ServiceClassName(serviceClass *v1beta1.ServiceClass) string

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

func ServiceInstanceName added in v0.1.1

func ServiceInstanceName(instance *v1beta1.ServiceInstance) string

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

func ServicePlanName added in v0.1.31

func ServicePlanName(servicePlan *v1beta1.ServicePlan) string

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

Types

type ContextBuilder

type ContextBuilder struct {
	Kind            Kind
	Namespace       string
	Name            string
	ResourceVersion 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>" v<ResourceVersion>: <message>

func NewBindingContextBuilder added in v0.1.31

func NewBindingContextBuilder(binding *v1beta1.ServiceBinding) *ContextBuilder

NewBindingContextBuilder returns a new ContextBuilder that can be used to format messages in the form `ServiceBinding "<Namespace>/<Name>" v<ResourceVersion>: <message>`.

func NewClusterServiceBrokerContextBuilder added in v0.1.31

func NewClusterServiceBrokerContextBuilder(broker *v1beta1.ClusterServiceBroker) *ContextBuilder

NewClusterServiceBrokerContextBuilder returns a new ContextBuilder that can be used to format messages in the form `ClusterServiceBroker "<Name>" v<ResourceVersion>: <message>`.

func NewContextBuilder

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

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

func NewInstanceContextBuilder added in v0.1.31

func NewInstanceContextBuilder(instance *v1beta1.ServiceInstance) *ContextBuilder

NewInstanceContextBuilder returns a new ContextBuilder that can be used to format messages in the form `ServiceInstance "<Namespace>/<Name>" v<ResourceVersion>: <message>`.

func NewServiceBrokerContextBuilder added in v0.1.31

func NewServiceBrokerContextBuilder(broker *v1beta1.ServiceBroker) *ContextBuilder

NewServiceBrokerContextBuilder returns a new ContextBuilder that can be used to format messages in the form `ServiceBroker "<Namespace>/<Name>" v<ResourceVersion>: <message>`.

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
	ServiceBroker
	ClusterServiceClass
	ServiceClass
	ClusterServicePlan
	ServicePlan
	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