logging

package
v0.0.0-...-1a79b73 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Activity

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

Activity is a buffered logger associated with an on-screen spinner. As well as being able to signal completion state (EndWithSuccess, EndWithWarning and EndWithFailure), logs can be buffered. Whether or not the logs are actually displayed depends on the completion state.

func (*Activity) EndWithFailure

func (a *Activity) EndWithFailure(message interface{})

func (*Activity) EndWithFailuref

func (a *Activity) EndWithFailuref(format string, args ...interface{})

func (*Activity) EndWithSuccess

func (a *Activity) EndWithSuccess()

func (*Activity) EndWithSuccessAndEmitLogs

func (a *Activity) EndWithSuccessAndEmitLogs()

func (*Activity) EndWithWarning

func (a *Activity) EndWithWarning(message interface{})

func (*Activity) EndWithWarningf

func (a *Activity) EndWithWarningf(format string, args ...interface{})

func (*Activity) Log

func (a *Activity) Log(message string)

func (*Activity) Logf

func (a *Activity) Logf(format string, args ...interface{})

func (*Activity) Logs

func (a *Activity) Logs() string

func (*Activity) Writer

func (a *Activity) Writer() io.Writer

type Logger

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

Logger is a facade for CLI logging.

func NewLogger

func NewLogger(c *cobra.Command) *Logger

NewLogger creates a Logger associated with a particular *cobra.Command instance. Logs will be delivered to the command's stdout writer.

func (*Logger) Errorf

func (log *Logger) Errorf(format string, args ...interface{})

func (*Logger) Printf

func (log *Logger) Printf(s string, args ...interface{})

func (*Logger) Println

func (log *Logger) Println(s ...interface{})

func (*Logger) StartActivity

func (log *Logger) StartActivity(format string, args ...interface{}) *Activity

StartActivity creates and starts an *Activity with an associated spinner. Only once Activity should be active at any given time, and the Activity should be completed before any other logging is performed using this Logger.

func (*Logger) Successf

func (log *Logger) Successf(format string, args ...interface{})

func (*Logger) Warnf

func (log *Logger) Warnf(format string, args ...interface{})

func (*Logger) Writer

func (log *Logger) Writer() io.Writer

Jump to

Keyboard shortcuts

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