log

package
v2.11.1 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultLogLevel = WarnLevel

DefaultLogLevel for the global Skaffold logger

Variables

AllLevels exposes all logging levels

View Source
var ContextKey = contextKey{}

Functions

func AddHook

func AddHook(hook logrus.Hook)

AddHook adds a hook to the global Skaffold logger.

func Entry

func Entry(ctx context.Context) *logrus.Entry

Entry takes an context.Context and constructs a logrus.Entry from it, adding fields for task and subtask information

func GetWriter added in v2.11.0

func GetWriter() io.Writer

Returns the output used by the logger to write its content.

func IsDebugLevelEnabled

func IsDebugLevelEnabled() bool

IsDebugLevelEnabled returns true if debug level log is enabled.

func IsTraceLevelEnabled

func IsTraceLevelEnabled() bool

IsTraceLevelEnabled returns true if trace level log is enabled.

func KanikoLogLevel

func KanikoLogLevel() logrus.Level

KanikoLogLevel makes sure kaniko logs at least at Info level and at most Debug level (trace doesn't work with Kaniko)

func New

func New() *logrus.Logger

New returns a new logrus.Logger. We use a new instance instead of the default logrus singleton to avoid clashes with dependencies that also use logrus.

func SetLevel

func SetLevel(level Level)

SetLevel sets the global Skaffold logger level.

func SetupLogs

func SetupLogs(stdErr io.Writer, level string, timestamp bool, hook logrus.Hook) error

SetupLogs sets up logrus logger for skaffold command line

Types

type EventContext

type EventContext struct {
	Task    constants.Phase
	Subtask string
}

type Level

type Level uint32

Level type for logging levels

const (
	// PanicLevel level, highest level of severity. Logs and then calls panic with the
	// message passed to Debug, Info, ...
	PanicLevel Level = iota
	// FatalLevel level. Logs and then calls `logger.Exit(1)`. It will exit even if the
	// logging level is set to Panic.
	FatalLevel
	// ErrorLevel level. Logs. Used for errors that should definitely be noted.
	// Commonly used for hooks to send errors to an error tracking service.
	ErrorLevel
	// WarnLevel level. Non-critical entries that deserve eyes.
	WarnLevel
	// InfoLevel level. General operational entries about what's going on inside the
	// application.
	InfoLevel
	// DebugLevel level. Usually only enabled when debugging. Very verbose logging.
	DebugLevel
	// TraceLevel level. Designates finer-grained informational events than the Debug.
	TraceLevel
)

Logging levels. Defining our own so we can encapsulate the underlying logger implementation.

func GetLevel

func GetLevel() Level

GetLevel returns the global Skaffold logger level.

func (Level) String

func (level Level) String() string

String converts the Level to a string. E.g. PanicLevel becomes "panic".

Jump to

Keyboard shortcuts

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