Documentation ¶
Overview ¶
Package log wrappers slog for the kwok and kwokctl
Index ¶
- Constants
- func IsTerminal() bool
- func NewContext(ctx context.Context, logger *Logger) context.Context
- func ToKlogLevel(level Level) int
- func ToLogSeverityLevel(level Level) string
- type DurationFormat
- type KMetadata
- type Level
- type Logger
- func (l *Logger) Debug(msg string, args ...any)
- func (l *Logger) Error(msg string, err error, args ...any)
- func (l *Logger) Info(msg string, args ...any)
- func (l *Logger) Level() Level
- func (l *Logger) Log(level Level, msg string, args ...any)
- func (l *Logger) Warn(msg string, args ...any)
- func (l *Logger) With(args ...any) *Logger
- func (l *Logger) WithGroup(name string) *Logger
- type ObjectRef
Constants ¶
const ( InfoLevelSecurity = "info" DebugLevelSecurity = "debug" WarnLevelSecurity = "warn" ErrorLevelSecurity = "error" )
The following is Level security definitions.
Variables ¶
This section is empty.
Functions ¶
func IsTerminal ¶
func IsTerminal() bool
IsTerminal returns true if the given file descriptor is a terminal.
func NewContext ¶
NewContext returns a new context with the given logger.
func ToKlogLevel ¶ added in v0.2.0
ToKlogLevel maps the current logging level to a Klog level integer
func ToLogSeverityLevel ¶ added in v0.2.0
ToLogSeverityLevel maps the current logging level to a severity level string
Types ¶
type DurationFormat ¶ added in v0.2.0
DurationFormat is the format used to print time.Duration in both nanosecond and string.
type KMetadata ¶
KMetadata is a subset of the kubernetes k8s.io/apimachinery/pkg/apis/meta/v1.Object interface this interface may expand in the future, but will always be a subset of the kubernetes k8s.io/apimachinery/pkg/apis/meta/v1.Object interface
type Level ¶
Level is the logging level.
const ( LevelDebug Level = slog.LevelDebug LevelInfo Level = slog.LevelInfo LevelWarn Level = slog.LevelWarn LevelError Level = slog.LevelError )
The following is Level definitions copied from slog.
func ParseLevel ¶ added in v0.2.0
ParseLevel parses a level string.
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger is a wrapper around slog.Handler.
func FromContext ¶
FromContext returns the Logger associated with ctx, or the default logger.