internal

package
v0.0.0-...-cf400fd Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitLogger

func InitLogger(filename string) (*zap.Logger, error)

InitLogger is used to construct the zap logger for logging info

Types

type App

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

App struct holds list dependencies for managing the watcher app

func InitApp

func InitApp(configStr string, logger *zap.Logger) (*App, error)

InitApp is used to construct app

default configStr: ~/.kube/config

func (*App) Wait

func (app *App) Wait()

Wait is used for wait all runner done their tasks

func (*App) WatchPodChanges

func (app *App) WatchPodChanges(ctx context.Context, namespace string, callbacks ...callback) error

WatchPodChanges is used to watch changes all pods of a given namespace, and execute list callback function

func (*App) WatchPodChangesAllNameSpaces

func (app *App) WatchPodChangesAllNameSpaces(ctx context.Context, callbacks ...callback) error

WatchPodChangesAllNameSpaces is async function to watch all pod for all existed namespaces and execute list callback function

For the safe usage it should be controlled by Context, after context was done use function Wait to wait all runner done their tasks

type ParallelStdout

type ParallelStdout struct {
	*os.File
}

ParallelStdout is the wrapped struct of *os.File to handle logic show log to the console

func NewParallelStdout

func NewParallelStdout(logFileName string) (*ParallelStdout, error)

NewParallelStdout used to init parallel logger: one for stdout console, two is for file log

func (*ParallelStdout) Write

func (ps *ParallelStdout) Write(p []byte) (n int, err error)

Write will show log to the console and run the parent `Write` implementation

Jump to

Keyboard shortcuts

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