context

package
v1.43.0 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDefaultLogger

func GetDefaultLogger() *zap.SugaredLogger

GetDefaultLogger retrieves the default logger

func GetLoggerWithOptions

func GetLoggerWithOptions(name string, options *Opts) *zap.SugaredLogger

GetLoggerWithOptions returns a custom named logger with given options

Types

type CommandContext

type CommandContext struct {
	// CommonPreRun is the common pre run function that should run before the command execution
	CommonPreRun func(cmd *cobra.Command, args []string)
	// CommonPostRun is the common post run function that should run after the command execution
	CommonPostRun func(cmd *cobra.Command, args []string)
	// Client is the Kubernetes client used to call the Kubernetes API
	Client *client.Client
}

CommandContext is the data structure to support command executions with hooks, configurations, and other execution details

type CommandFactory

type CommandFactory struct {
	// BuildCommands creates the command hierarchy for a given feature
	BuildCommands func(ctx *CommandContext, rootCommand *cobra.Command)
}

CommandFactory supports inner commands creation

type KogitoCommand

type KogitoCommand interface {
	RegisterHook()
	InitHook()
	Command() *cobra.Command
}

KogitoCommand is the standard interface for any Kogito CLI command

func NewRootCommand

func NewRootCommand(commandContext *CommandContext, output io.Writer) KogitoCommand

NewRootCommand is the constructor for the root command

type Logger

type Logger struct {
	Logger        logr.Logger
	SugaredLogger *zap.SugaredLogger
}

Logger shared logger struct

type Opts

type Opts struct {
	// Verbose will increase logging
	Verbose bool
	// Output specifies where to log
	Output io.Writer
	// Output format
	OutputFormat string
	// Console logging doesn't display level nor timestamp and should be readable by humans
	Console bool
}

Opts describe logger options

Jump to

Keyboard shortcuts

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