Documentation ¶
Index ¶
- Constants
- Variables
- func Blue(l Logger) *color.Color
- func CtxWithForkedOutput(ctx context.Context, writer io.Writer) context.Context
- func CtxWithLogHandler(ctx context.Context, handler LogHandler) context.Context
- func Green(l Logger) *color.Color
- func NewPrefixedLogger(prefix string, original Logger) *prefixedLogger
- func Red(l Logger) *color.Color
- func WithLogger(ctx context.Context, logger Logger) context.Context
- func Yellow(l Logger) *color.Color
- type DeferredLogger
- type Fields
- type FuncLoggerWriter
- type Level
- type LogHandler
- type Logger
- type MutexWriter
Constants ¶
const FieldNameBuildEvent = "buildEvent"
const FieldNameProgressID = "progressID"
const FieldNameProgressMustPrint = "progressMustPrint"
Most progress lines are optional. For example, if a bunch of little upload updates come in, it's ok to skip some.
progressMustPrint="1" indicates that this line must appear in the output - e.g., a line that communicates that the upload finished.
Variables ¶
var ( NoneLvl = Level{/* contains filtered or unexported fields */} DebugLvl = Level{/* contains filtered or unexported fields */} VerboseLvl = Level{/* contains filtered or unexported fields */} InfoLvl = Level{/* contains filtered or unexported fields */} WarnLvl = Level{/* contains filtered or unexported fields */} ErrorLvl = Level{/* contains filtered or unexported fields */} )
var LoggerContextKey = contextKey{}
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 CtxWithLogHandler ¶ added in v0.10.25
func CtxWithLogHandler(ctx context.Context, handler LogHandler) context.Context
func NewPrefixedLogger ¶ added in v0.14.0
Types ¶
type DeferredLogger ¶
type DeferredLogger struct { Logger // contains filtered or unexported fields }
A logger that buffers its log lines until we have an output logger.
func NewDeferredLogger ¶
func NewDeferredLogger(ctx context.Context) *DeferredLogger
func (*DeferredLogger) CopyBuffered ¶ added in v0.15.0
func (dl *DeferredLogger) CopyBuffered(lvl Level) *bytes.Buffer
func (*DeferredLogger) Original ¶
func (dl *DeferredLogger) Original() Logger
The original logger that we're deferring output away from.
func (*DeferredLogger) SetOutput ¶
func (dl *DeferredLogger) SetOutput(l Logger)
Set the output logger, and send all the buffered output to the new logger.
type Fields ¶ added in v0.14.0
Allow arbitrary fields on a log. Inspired by the logrus.Fields API https://github.com/sirupsen/logrus
type FuncLoggerWriter ¶
type FuncLoggerWriter struct {
// contains filtered or unexported fields
}
type Level ¶
type Level struct {
// contains filtered or unexported fields
}
func (Level) AsSevereAs ¶ added in v0.14.0
func (Level) ShouldDisplay ¶ added in v0.14.0
If l is the logger level, determine if we should display logs of the given severity.
type LogHandler ¶ added in v0.10.25
type Logger ¶
type Logger interface { // log information that is likely to only be of interest to tilt developers Debugf(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 we always want to show Infof(format string, a ...interface{}) // Warnings to show in the alert pane. Warnf(format string, a ...interface{}) // Halting errors to show in the alert pane. Errorf(format string, a ...interface{}) Write(level Level, bytes []byte) // 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 WithFields(fields Fields) Logger }
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 ¶
type MutexWriter ¶ added in v0.14.0
type MutexWriter struct {
// contains filtered or unexported fields
}
func NewMutexWriter ¶ added in v0.14.0
func NewMutexWriter(underlying io.Writer) MutexWriter