Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ComputeHash ¶
func DoesPathExist ¶
DoesPathExist determines if a specific file or directory path exists or not
func IsDirectory ¶
IsDirectory determines if a file represented by `path` is a directory or not
func NormalizePath ¶
NormalizePath handles any path updates necessary for standard path resolution:
func ToJSON ¶
JSONString returns a JSON string representation of the given data. This is intended for use in debugging easily (e.g. `log.Debugf("received: %s", to.JSONString(body))`), and so returns one string. Since this has no errors, we make efforts to return reasonable values that are always legal JSON strings: - If input is nil {} - If data is an error, a string representation of the error "error message" - If data cannot be marshalled, a "%#v" string representation of the data "main.T{b:true, i:42, s:[]string{\"life\", \"universe\", \"everything\"}}" - Otherwise, the JSON representation of the data (no private fields, etc)
Types ¶
type IndentingReport ¶
type IndentingReport struct {
Level ReportLevel // true to print to stderr, false to log
Size int // total number of report lines printed (not including section headers)
// contains filtered or unexported fields
}
IndentingReport manages printing out a report with indents. Every time you start a section, the indent will be increased, and when you end a section the indent will be decreased. Sections titles are not printed unless there is something under them. So you can start a section whenever you want, defer the end of the section, and if nothing gets printed in the meantime, then nothing about the section will ever be printed
func NewIndentingReport ¶
func NewIndentingReport(level ReportLevel) *IndentingReport
func (*IndentingReport) Printf ¶
func (r *IndentingReport) Printf(format string, a ...interface{})
Prints a report line to the appropriate output channel
func (*IndentingReport) StartSection ¶
func (r *IndentingReport) StartSection(title string)
StartSection starts a new section in the report by printing a title and indenting subsequent output by one level. The section title is not printed unless there is actually something to print under it though
func (*IndentingReport) StopSection ¶
func (r *IndentingReport) StopSection()
StopSection stops a section by reducing the indent on subsequent output
func (*IndentingReport) String ¶
func (r *IndentingReport) String() string
String returns the cached report as a string
type ReportLevel ¶
type ReportLevel string
const ( ReportSilent ReportLevel = "silent" // do not write the report anywhere (get it later with String()) ReportLog ReportLevel = "log" // write the report to the log ReportErr ReportLevel = "err" // write the report to stderr ReportOut ReportLevel = "out" // write the report to stdout )
type StopWatch ¶
func NewStopWatch ¶
func NewStopWatch() StopWatch
func (StopWatch) Elapsed ¶
Elapsed returns either the duration since the watch was started (if it hasn't been stopped yet), or the duration between start and stop (if it is stopped)