Documentation
¶
Index ¶
- Constants
- type Printer
- func (p *Printer) Error(err error, msg string, keysAndValues ...any)
- func (p *Printer) Info(msg string, keysAndValues ...any)
- func (p *Printer) LogArgParse(inputArgv *[]string)
- func (p *Printer) LogMaskedArgParse(inputArgv []string)
- func (p *Printer) PrintError(msg string, v ...any)
- func (p *Printer) PrintInfo(msg string, v ...any)
- func (p *Printer) PrintWarning(msg string, v ...any)
- func (p *Printer) PrintWithIndent(msg string, v ...any)
- func (p *Printer) SetupOrDie(logFile string)
- func (p *Printer) V(level int) logr.Logger
- func (p *Printer) WithName(logName string) Printer
Constants ¶
const ( InfoLog = "[INFO] " WarningLog = "[WARNING] " ErrorLog = "[ERROR] " DebugLog = "[DEBUG] " )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Printer ¶
type Printer struct { Log logr.Logger LogToFileOnly bool // ForCli can indicate if vclusterops is called from vcluster cli or other clients ForCli bool }
Printer is a wrapper for the logger API that handles dual logging to the log and stdout. It reimplements all of the APIs from logr but adds two additional members: one is for printing messages to stdout, and the other one is for identifying where the logger came from.
func (*Printer) LogArgParse ¶
log functions for specific cases.
func (*Printer) LogMaskedArgParse ¶
log functions with masked params
func (*Printer) PrintError ¶
PrintError will display the given error message in the log. And if not logging to stdout, it will repeat the message to the console.
func (*Printer) PrintInfo ¶
PrintInfo will display the given message in the log. And if not logging to stdout, it will repeat the message to the console.
func (*Printer) PrintWarning ¶
PrintWarning will display the given warning message in the log. And if not logging to stdout, it will repeat the message to the console.
func (*Printer) PrintWithIndent ¶ added in v1.0.0
PrintWithIndent prints message to console only with an indentation
func (*Printer) SetupOrDie ¶
setupOrDie will setup the logging for vcluster CLI. One exit, p.Log will be set.