output

package
v2.2.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 1, 2021 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package output provides functions for displaying information to the end user.

Index

Constants

View Source
const LogPath = ".platform_cc.log"

LogPath is the path to the log file.

Variables

View Source
var Enable = false

Enable is a flag that enables terminal output.

View Source
var IndentLevel = 0

IndentLevel is the current indentation level.

View Source
var Logging = false

Logging is a flag that enables writting to log file.

View Source
var Verbose = false

Verbose is a flag that enables more verbose output.

Functions

func Color

func Color(msg string, color int) string

Color returns given message terminal color formatting.

func ContainerLog

func ContainerLog(name string, msg string)

ContainerLog prints container log line to stdout.

func Duration

func Duration(msg string) func()

Duration prints information and returns channel

func Error

func Error(err error)

Error prints an error message to the terminal and then exists.

func ErrorText

func ErrorText(msg string)

ErrorText prints message using the error text color.

func Info

func Info(msg string)

Info prints information to the terminal.

func IsTTY

func IsTTY() bool

IsTTY returns true if running with a TTY.

func LogDebug

func LogDebug(msg string, data interface{})

LogDebug writes debug message to log file.

func LogError

func LogError(err error)

LogError writes error to log file.

func LogInfo

func LogInfo(msg string)

LogInfo writes info to log file.

func LogRotate

func LogRotate() error

LogRotate trims the log file.

func LogWarn

func LogWarn(msg string)

LogWarn writes warning to log file.

func Progress

func Progress(msgs []string) func(i int, s ProgressMessageState, cur *int64, total *int64)

Progress prints progress messages with state and returns function that updates progress when called.

func Warn

func Warn(msg string)

Warn prints a warning message to the terminal.

func WriteStderr

func WriteStderr(msg string)

WriteStderr writes a string to STDERR.

func WriteStdout

func WriteStdout(msg string)

WriteStdout writes a string to STDOUT.

Types

type ProgressMessageState

type ProgressMessageState int

ProgressMessageState is the state of a progress message.

const (
	// ProgressMessageWait is a waiting state.
	ProgressMessageWait ProgressMessageState = 1 << iota
	// ProgressMessageDone is a done state.
	ProgressMessageDone
	// ProgressMessageSkip is a skipped state.
	ProgressMessageSkip
	// ProgressMessageError is an error state.
	ProgressMessageError
	// ProgressMessageCancel is a canceled state.
	ProgressMessageCancel
)

func (ProgressMessageState) String

func (p ProgressMessageState) String() string

String returns a string representation of the state.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL