Documentation
¶
Index ¶
- Constants
- func Blue(l Logger) *color.Color
- func CtxWithForkedOutput(ctx context.Context, writer io.Writer) context.Context
- func Green(l Logger) *color.Color
- func NewPrefixedWriter(prefix string, underlying io.Writer) *prefixedWriter
- func Red(l Logger) *color.Color
- func WithLogger(ctx context.Context, logger Logger) context.Context
- func Yellow(l Logger) *color.Color
- type FuncLoggerWriter
- type Level
- type Logger
Constants ¶
View Source
const (
NoneLvl = iota
InfoLvl
VerboseLvl
DebugLvl
)
Variables ¶
This section is empty.
Functions ¶
func CtxWithForkedOutput ¶
func CtxWithForkedOutput(ctx context.Context, writer io.Writer) context.Context
Returns a context containing a logger that forks all of its output to both the parent context's logger and to the given `io.Writer`
func NewPrefixedWriter ¶
func NewPrefixedWriter(prefix string, underlying io.Writer) *prefixedWriter
func WithLogger ¶
func WithLogger(ctx context.Context, logger Logger) context.Context
Types ¶
type FuncLoggerWriter ¶
type FuncLoggerWriter struct {
// contains filtered or unexported fields
}
type Logger ¶
type Logger interface {
// log information that we always want to show
Infof(format string, a ...interface{})
// log information that a tilt user might not want to see on every run, but that they might find
// useful when debugging their Tiltfile/docker/k8s configs
Verbosef(format string, a ...interface{})
// log information that is likely to only be of interest to tilt developers
Debugf(format string, a ...interface{})
Write(level Level, s string)
// gets an io.Writer that filters to the specified level for, e.g., passing to a subprocess
Writer(level Level) io.Writer
Level() Level
SupportsColor() bool
}
Logger with better controls for levels and colors.
Note that our loggers often serve as both traditional loggers (where each call to PodLog() is a discrete log entry that may be emitted as JSON or with newlines) and as Writers (where each call to Write() may be part of a larger output stream, and each message may not end in a newline).
Logger implementations that bridge these two worlds should have discrete messages (like Infof) append a newline to the string before passing it to Write().
func NewFuncLogger ¶
func NewFuncLogger(supportsColor bool, level Level, write func(level Level, b []byte) error) Logger
Click to show internal directories.
Click to hide internal directories.