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 DeferredLogger
- type FuncLoggerWriter
- type Level
- type Logger
Constants ¶
const ( NoneLvl = iota InfoLvl VerboseLvl DebugLvl )
Variables ¶
This section is empty.
Functions ¶
func CtxWithForkedOutput ¶
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 ¶
Types ¶
type DeferredLogger ¶ added in v0.8.9
type DeferredLogger struct { Logger // contains filtered or unexported fields }
A logger that buffers its log lines until we have an output logger.
func NewDeferredLogger ¶ added in v0.8.9
func NewDeferredLogger(ctx context.Context) *DeferredLogger
func (*DeferredLogger) Original ¶ added in v0.8.9
func (dl *DeferredLogger) Original() Logger
The original logger that we're deferring output away from.
func (*DeferredLogger) SetOutput ¶ added in v0.8.9
func (dl *DeferredLogger) SetOutput(l Logger)
Set the output logger, and send all the buffered output to the new logger.
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().