Documentation ¶
Index ¶
- Constants
- type BufferedLogger
- type BundleBuilder
- type ColorMode
- type ConsoleLogger
- func (cl ConsoleLogger) DebugBytes(data []byte)
- func (cl ConsoleLogger) DebugPrintf(format string, args ...interface{})
- func (cl ConsoleLogger) MarkBundleBuilderResult(isError, isCanceled bool)
- func (cl ConsoleLogger) MarkBundleBuilderStatus(isStarted, isFinished, isCanceled bool)
- func (cl ConsoleLogger) Prefix() string
- func (cl ConsoleLogger) PrefixColor() *color.Color
- func (cl ConsoleLogger) PrintBar(c *color.Color, msg, phase string)
- func (cl ConsoleLogger) PrintBytes(data []byte)
- func (cl ConsoleLogger) PrintFailure(phase string)
- func (cl ConsoleLogger) PrintPhaseFooter(phase string, disabled bool, special string)
- func (cl ConsoleLogger) PrintPhaseHeader(phase string, disabled bool, special string)
- func (cl ConsoleLogger) PrintSuccess()
- func (cl ConsoleLogger) Printf(format string, args ...interface{})
- func (cl ConsoleLogger) Salt() string
- func (cl ConsoleLogger) VerboseBytes(data []byte)
- func (cl ConsoleLogger) VerbosePrintf(format string, args ...interface{})
- func (cl ConsoleLogger) Warnf(format string, args ...interface{})
- func (cl ConsoleLogger) WithCached(isCached bool) ConsoleLogger
- func (cl ConsoleLogger) WithFailed(isFailed bool) ConsoleLogger
- func (cl ConsoleLogger) WithLocal(isLocal bool) ConsoleLogger
- func (cl ConsoleLogger) WithLogBundleWriter(entrypoint string, collection *cleanup.Collection) ConsoleLogger
- func (cl ConsoleLogger) WithLogLevel(logLevel LogLevel) ConsoleLogger
- func (cl ConsoleLogger) WithMetadataMode(metadataMode bool) ConsoleLogger
- func (cl ConsoleLogger) WithPrefix(prefix string) ConsoleLogger
- func (cl ConsoleLogger) WithPrefixAndSalt(prefix string, salt string) ConsoleLogger
- func (cl ConsoleLogger) WithPrefixWriter(w PrefixWriter) ConsoleLogger
- func (cl ConsoleLogger) WithWriter(w io.Writer) ConsoleLogger
- func (cl ConsoleLogger) WriteBundleToDisk() (string, error)
- type LogLevel
- type Manifest
- type Permissions
- type PrefixWriter
- type TargetManifest
Constants ¶
const ( // NoPadding means the old behavior of printing the full target only. NoPadding int = -1 // DefaultPadding always prints 20 characters for the target, right // justified. If it is longer, it prints the right 20 characters. DefaultPadding int = 20 )
const ( // StatusWaiting is the status for a target that has yet to execute. StatusWaiting = "waiting" // StatusInProgress is the status for a target that is currently executing. StatusInProgress = "in_progress" // StatusComplete is the status for a target that has run to completion. StatusComplete = "complete" // StatusCancelled is the status for a target that did not run to completion, and was interrupted. StatusCancelled = "cancelled" // ResultSuccess is the result for a target that exits successfully. ResultSuccess = "success" // ResultFailure is the result for a target that exited with some kind of error code. ResultFailure = "failure" // ResultCancelled is the results for a target that did not run to completion. ResultCancelled = "cancelled" )
These types are also used by our log server, too.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BufferedLogger ¶ added in v0.6.15
type BufferedLogger struct {
// contains filtered or unexported fields
}
BufferedLogger is a logger that queues up messages until Flush is called.
func NewBufferedLogger ¶ added in v0.6.15
func NewBufferedLogger(cl *ConsoleLogger) *BufferedLogger
NewBufferedLogger creates a new BufferedLogger.
func (*BufferedLogger) Flush ¶ added in v0.6.15
func (bl *BufferedLogger) Flush()
Flush prints the queued up messages to the underlying console.
func (*BufferedLogger) Printf ¶ added in v0.6.15
func (bl *BufferedLogger) Printf(format string, v ...interface{})
Printf prints a formatted string to the delayed console.
type BundleBuilder ¶ added in v0.6.15
type BundleBuilder struct {
// contains filtered or unexported fields
}
BundleBuilder builds log bundles for local storage or upload to a logging server
func NewBundleBuilder ¶ added in v0.6.15
func NewBundleBuilder(entrypoint string, cleanup *cleanup.Collection) *BundleBuilder
NewBundleBuilder makes a new BundleBuilder, that will write logs to the targeted root directory, and specify the entrypoint in the resulting manifest.
func (*BundleBuilder) PrefixResult ¶ added in v0.6.15
func (bb *BundleBuilder) PrefixResult(prefix, result string)
PrefixResult sets the prefix(aka target) result as it should appear in the manifest for that specific target.
func (*BundleBuilder) PrefixStatus ¶ added in v0.6.15
func (bb *BundleBuilder) PrefixStatus(prefix, status string)
PrefixStatus sets the prefix(aka target) result as it should appear in the manifest for that specific target.
func (*BundleBuilder) PrefixWriter ¶ added in v0.6.15
func (bb *BundleBuilder) PrefixWriter(prefix string) io.Writer
PrefixWriter gets an io.Writer for a given prefix(aka target). If its a prefix we have not seen before, then generate a new writer to accomodate it.
func (*BundleBuilder) WriteToDisk ¶ added in v0.6.15
func (bb *BundleBuilder) WriteToDisk() (string, error)
WriteToDisk aggregates all the data in the numerous prefix writers, and generates an Earthly log bundle. These bundles include a manifest generated from the aggregation of the prefixes (targets).
type ColorMode ¶ added in v0.3.0
type ColorMode int
ColorMode is the mode in which colors are represented in the output.
type ConsoleLogger ¶
type ConsoleLogger struct {
// contains filtered or unexported fields
}
ConsoleLogger is a writer for consoles.
func Current ¶
func Current(colorMode ColorMode, prefixPadding int, logLevel LogLevel) ConsoleLogger
Current returns the current console.
func New ¶ added in v0.6.30
func New(w io.Writer, mu *sync.Mutex, colorMode ColorMode, prefixPadding int, logLevel LogLevel) ConsoleLogger
New returns a new ConsoleLogger with a predefined target writer.
func (ConsoleLogger) DebugBytes ¶ added in v0.6.21
func (cl ConsoleLogger) DebugBytes(data []byte)
DebugBytes prints bytes directly to the console when debug flag is set.
func (ConsoleLogger) DebugPrintf ¶ added in v0.6.21
func (cl ConsoleLogger) DebugPrintf(format string, args ...interface{})
DebugPrintf prints formatted text to the console when debug flag is set.
func (ConsoleLogger) MarkBundleBuilderResult ¶ added in v0.6.15
func (cl ConsoleLogger) MarkBundleBuilderResult(isError, isCanceled bool)
MarkBundleBuilderResult marks the current targets result in a log bundle for a given prefix with the current result.
func (ConsoleLogger) MarkBundleBuilderStatus ¶ added in v0.6.15
func (cl ConsoleLogger) MarkBundleBuilderStatus(isStarted, isFinished, isCanceled bool)
MarkBundleBuilderStatus marks the current targets status in a log bundle for a given prefix with the current status.
func (ConsoleLogger) Prefix ¶
func (cl ConsoleLogger) Prefix() string
Prefix returns the console's prefix.
func (ConsoleLogger) PrefixColor ¶ added in v0.6.15
func (cl ConsoleLogger) PrefixColor() *color.Color
PrefixColor returns the color used for the prefix.
func (ConsoleLogger) PrintBar ¶ added in v0.6.15
func (cl ConsoleLogger) PrintBar(c *color.Color, msg, phase string)
PrintBar prints an earthly message bar.
func (ConsoleLogger) PrintBytes ¶
func (cl ConsoleLogger) PrintBytes(data []byte)
PrintBytes prints bytes directly to the console.
func (ConsoleLogger) PrintFailure ¶ added in v0.3.0
func (cl ConsoleLogger) PrintFailure(phase string)
PrintFailure prints the failure message.
func (ConsoleLogger) PrintPhaseFooter ¶ added in v0.6.15
func (cl ConsoleLogger) PrintPhaseFooter(phase string, disabled bool, special string)
PrintPhaseFooter prints the phase footer.
func (ConsoleLogger) PrintPhaseHeader ¶ added in v0.6.15
func (cl ConsoleLogger) PrintPhaseHeader(phase string, disabled bool, special string)
PrintPhaseHeader prints the phase header.
func (ConsoleLogger) PrintSuccess ¶
func (cl ConsoleLogger) PrintSuccess()
PrintSuccess prints the success message.
func (ConsoleLogger) Printf ¶
func (cl ConsoleLogger) Printf(format string, args ...interface{})
Printf prints formatted text to the console.
func (ConsoleLogger) Salt ¶ added in v0.6.15
func (cl ConsoleLogger) Salt() string
Salt returns the console's salt.
func (ConsoleLogger) VerboseBytes ¶ added in v0.6.15
func (cl ConsoleLogger) VerboseBytes(data []byte)
VerboseBytes prints bytes directly to the console when verbose flag is set.
func (ConsoleLogger) VerbosePrintf ¶ added in v0.6.15
func (cl ConsoleLogger) VerbosePrintf(format string, args ...interface{})
VerbosePrintf prints formatted text to the console when verbose flag is set.
func (ConsoleLogger) Warnf ¶ added in v0.2.0
func (cl ConsoleLogger) Warnf(format string, args ...interface{})
Warnf prints a warning message in red to errWriter.
func (ConsoleLogger) WithCached ¶
func (cl ConsoleLogger) WithCached(isCached bool) ConsoleLogger
WithCached returns a ConsoleLogger with isCached flag set accordingly.
func (ConsoleLogger) WithFailed ¶ added in v0.3.0
func (cl ConsoleLogger) WithFailed(isFailed bool) ConsoleLogger
WithFailed returns a ConsoleLogger with isFailed flag set accordingly.
func (ConsoleLogger) WithLocal ¶ added in v0.6.15
func (cl ConsoleLogger) WithLocal(isLocal bool) ConsoleLogger
WithLocal returns a ConsoleLogger with local set.
func (ConsoleLogger) WithLogBundleWriter ¶ added in v0.6.15
func (cl ConsoleLogger) WithLogBundleWriter(entrypoint string, collection *cleanup.Collection) ConsoleLogger
WithLogBundleWriter returns a ConsoleLogger with a BundleWriter attached to capture output into a log bundle, for upload to log sharing.
func (ConsoleLogger) WithLogLevel ¶ added in v0.6.15
func (cl ConsoleLogger) WithLogLevel(logLevel LogLevel) ConsoleLogger
WithLogLevel changes the log level
func (ConsoleLogger) WithMetadataMode ¶ added in v0.3.15
func (cl ConsoleLogger) WithMetadataMode(metadataMode bool) ConsoleLogger
WithMetadataMode returns a ConsoleLogger with metadata printing mode set.
func (ConsoleLogger) WithPrefix ¶
func (cl ConsoleLogger) WithPrefix(prefix string) ConsoleLogger
WithPrefix returns a ConsoleLogger with a prefix added.
func (ConsoleLogger) WithPrefixAndSalt ¶ added in v0.3.0
func (cl ConsoleLogger) WithPrefixAndSalt(prefix string, salt string) ConsoleLogger
WithPrefixAndSalt returns a ConsoleLogger with a prefix and a seed added.
func (ConsoleLogger) WithPrefixWriter ¶ added in v0.6.30
func (cl ConsoleLogger) WithPrefixWriter(w PrefixWriter) ConsoleLogger
WithPrefixWriter returns a ConsoleLogger with a prefix writer.
func (ConsoleLogger) WithWriter ¶ added in v0.6.15
func (cl ConsoleLogger) WithWriter(w io.Writer) ConsoleLogger
WithWriter returns a ConsoleLogger with stderr pointed at the provided io.Writer.
func (ConsoleLogger) WriteBundleToDisk ¶ added in v0.6.15
func (cl ConsoleLogger) WriteBundleToDisk() (string, error)
WriteBundleToDisk makes an attached bundle writer (if any) write the collected bundle to disk.
type LogLevel ¶ added in v0.6.15
type LogLevel int
LogLevel defines which types of log messages are displayed (e.g. warning, info, verbose)
type Manifest ¶ added in v0.6.15
type Manifest struct { Version int `json:"version"` Duration int `json:"duration"` Status string `json:"status"` Result string `json:"result"` CreatedAt time.Time `json:"created_at"` Targets []TargetManifest `json:"targets"` Entrypoint string `json:"entrypoint"` }
Manifest is the structure for the log bundle manifest, including all overarching data we need.
type Permissions ¶ added in v0.6.15
type Permissions struct { Version int `json:"version"` Users []string `json:"users"` Orgs []string `json:"orgs"` }
Permissions is the structure for the permissions manifest that can grant view rights to other Earthly users.
type PrefixWriter ¶ added in v0.6.30
type PrefixWriter interface { io.Writer // WithPrefix returns a new PrefixWriter with the given prefix. WithPrefix(prefix string) PrefixWriter }
PrefixWriter is a writer that can take a prefix.
type TargetManifest ¶ added in v0.6.15
type TargetManifest struct { Name string `json:"name"` Status string `json:"status"` Result string `json:"result"` Duration int `json:"duration"` Size int `json:"size"` Command string `json:"command,omitempty"` Summary string `json:"summary,omitempty"` }
TargetManifest is the structure for an individual target, indicating all relevant information.