log

package
v1.17.3 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsJSON added in v1.15.1

func AsJSON(o interface{}) fmt.Stringer

AsJSON returns a new stringer object that delays marshaling until the String method is called. For logging at higher verbosity levels, to avoid formatting when the output isn't going to be used.

func AsYAML added in v1.15.1

func AsYAML(o interface{}) fmt.Stringer

AsYAML returns a new stringer object that delays marshaling until the String method is called. For logging at higher verbosity levels, to avoid formatting when the output isn't going to be used. The primary use is for logging Kubernetes objects, but should also work with other types, like Go structs.

func AsYAMLDiff added in v1.15.1

func AsYAMLDiff(old, new interface{}) fmt.Stringer

AsYAMLDiff returns a new stringer object that delays marshaling and diffing until the String method is called. For logging at higher verbosity levels, to avoid formatting when the output isn't going to be used. The primary use is for comparing two Kubernetes objects, but should also work with other types, like Go structs. Does not do any object type or version conversion.

func AsYAMLDiffWithScheme added in v1.15.1

func AsYAMLDiffWithScheme(old, new runtime.Object, scheme *runtime.Scheme) fmt.Stringer

AsYAMLDiffWithScheme is similar to AsYAMLDiff, except it allows specifying which scheme to use to encode the objects, instead of defaulting to the global `core.Scheme`.

func AsYAMLWithScheme added in v1.15.1

func AsYAMLWithScheme(obj runtime.Object, scheme *runtime.Scheme) fmt.Stringer

AsYAMLWithScheme is similar to AsYAML, except it allows specifying which scheme to use to encode the object, instead of defaulting to the global `core.Scheme`.

func HandleError

func HandleError(log *Logger, printUsage bool, format string, a ...interface{})

HandleError prints the error to the standard error, prints the usage if the `printUsage` flag is true, exports the error to the error file and exits the process with the exit code.

func Setup

func Setup()

Setup sets up default logging configs for Nomos applications and logs the preamble.

Types

type Logger

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

Logger embeds logr.Logger

func NewLogger

func NewLogger(l logr.Logger, root string, errorFile string) *Logger

NewLogger returns logr implemented logr.Logger.

func (*Logger) DeleteErrorFile

func (l *Logger) DeleteErrorFile()

DeleteErrorFile deletes the error file.

func (*Logger) Error

func (l *Logger) Error(err error, msg string, kvList ...interface{})

Error implements logr.Logger.Error.

func (*Logger) ExportError

func (l *Logger) ExportError(content string)

ExportError exports the error to the error file if --export-error is enabled.

Jump to

Keyboard shortcuts

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