display

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2019 License: MPL-2.0 Imports: 15 Imported by: 16

Documentation

Overview

Package display implements functions for displaying output to users.

Index

Constants

This section is empty.

Variables

View Source
var TestHandler log.Handler

TestHandler collects log entries during testing.

Functions

func ClearProgress

func ClearProgress()

ClearProgress stops a progress spinner.

func File

func File() string

File returns the log file name.

func Handler

func Handler(entry *log.Entry) error

Handler handles log entries. It multiplexes them into two outputs, writing human-readable messages to STDERR and machine-readable entries to a log file.

TODO: does this need to be synchronised?

func InProgress

func InProgress(message string)

InProgress shows a progress spinner with a message.

func JSON

func JSON(data interface{}) (int, error)

JSON is a convenience function for printing JSON to STDOUT.

func SetDebug

func SetDebug(debug bool, setVerbose bool)

SetDebug turns debug logging to STDERR on or off.

The log file always writes debug-level entries.

func SetFile

func SetFile(filename string) error

SetFile sets the log file. By default, this is set to a temporary file.

func SetInteractive

func SetInteractive(interactive bool)

SetInteractive turns colors and ANSI control characters on or off.

func Template

func Template(tmpl *template.Template, data interface{}) (string, error)

Template renders a template and its context to a string.

func TemplateFile

func TemplateFile(filename string, data interface{}) (string, error)

TemplateFile renders a template file and its context to string.

func TemplateFormatTabs added in v0.7.27

func TemplateFormatTabs(tmpl string, data interface{}, minWidth, tabWidth, padding int) (string, error)

TemplateFormatTabs renders a template with the desired tab format.

func TemplateString added in v0.7.27

func TemplateString(templateString string, data interface{}) (string, error)

TemplateString renders a template from a string template.

func Test

func Test()

Test sets up logging with testing defaults.

Types

This section is empty.

Jump to

Keyboard shortcuts

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