utils

package
v0.10.13 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2019 License: Apache-2.0 Imports: 13 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Coalesce

func Coalesce(values ...string) string

Coalesce - return the first non empty string

func ConfigureInteractiveLogging

func ConfigureInteractiveLogging(level logging.Level)

ConfigureInteractiveLogging - logging

func ConfigureStandardLogging

func ConfigureStandardLogging(level logging.Level)

ConfigureStandardLogging - verbose

func ConfigureStandardLoggingLevel

func ConfigureStandardLoggingLevel(level logging.Level)

ConfigureStandardLoggingLevel - logging

func ConvertToLoggingLevel

func ConvertToLoggingLevel(verbose bool) logging.Level

ConvertToLoggingLevel - convert to

func CopyDir

func CopyDir(src string, dst string) (err error)

CopyDir recursively copies a directory tree, attempting to preserve permissions. Source directory must exist, destination directory must *not* exist. Symlinks are ignored and skipped.

func CopyFile

func CopyFile(src, dst string) (err error)

CopyFile copies the contents of the file named src to the file named by dst. The file will be created if it does not already exist. If the destination file exists, all it's contents will be replaced by the contents of the source file. The file mode will be copied from the source and the copied data is synced/flushed to stable storage.

func Join

func Join(separator string, values ...string) string

Join - using the separator join the strings

func LaunchBrowser

func LaunchBrowser(url string)

LaunchBrowser will open a browser

func MeasureElapsed

func MeasureElapsed(msg string, fn func())

MeasureElapsed - measure the time taken to complete the function

func ParseIntFromSlug

func ParseIntFromSlug(slug string, index int) (int, bool)

ParseIntFromSlug - return the index from a slug

func ParseIntFromString

func ParseIntFromString(data string) int

ParseIntFromString - return a int where possible

func ParseTimeFromString

func ParseTimeFromString(str string) time.Time

ParseTimeFromString attempts to parse the string value into a time.Time struct

Types

type FileIgnorer

type FileIgnorer struct {
	// contains filtered or unexported fields
}

FileIgnorer allows specifying groups of files to be ignored based on Glob or prefix file path matching.

func NewFileIgnorer

func NewFileIgnorer(root string, patterns []string) FileIgnorer

NewFileIgnorer creates a new FileIgnorer and sets the correct paths

func (FileIgnorer) IsIgnored

func (fm FileIgnorer) IsIgnored(path string) bool

IsIgnored returns whether the specified path should be ignored based on the matching the current patterns.

type LogReader

type LogReader interface {
	Logs() []string
	Clear()
}

LogReader - reads logs

type Stopwatch

type Stopwatch struct {
	// contains filtered or unexported fields
}

Stopwatch - track a stop watch

func NewStopwatch

func NewStopwatch(msg string) *Stopwatch

NewStopwatch - start a stop watch

func NewStopwatchLevel

func NewStopwatchLevel(msg string, level logging.Level) *Stopwatch

NewStopwatchLevel - start a stop watch with a level

func NewStopwatchf

func NewStopwatchf(msg string, a ...interface{}) *Stopwatch

NewStopwatchf - start a stop watch with formatting

func (*Stopwatch) Completed

func (sw *Stopwatch) Completed() time.Duration

Completed - stops the stop watch

type UniqueLogger

type UniqueLogger struct {
	// contains filtered or unexported fields
}

UniqueLogger - logs only the unique errors

func ConfigureSyncLogging

func ConfigureSyncLogging(level logging.Level) *UniqueLogger

ConfigureSyncLogging - logging only to the unique logger

func ConfigureWatchedLogging

func ConfigureWatchedLogging(level logging.Level) *UniqueLogger

ConfigureWatchedLogging - logging to stdout + the unique logger

func NewUniqueLogger

func NewUniqueLogger(level logging.Level) *UniqueLogger

NewUniqueLogger - creates a new unique logger

func (*UniqueLogger) Clear

func (l *UniqueLogger) Clear()

Clear the logs

func (*UniqueLogger) Log

func (l *UniqueLogger) Log(level logging.Level, calldepth int, rec *logging.Record) (err error)

Log - only the unique errors

func (*UniqueLogger) Logs

func (l *UniqueLogger) Logs() []string

Logs -

Jump to

Keyboard shortcuts

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