Documentation ¶
Index ¶
- Variables
- func Ar(a ...string) []string
- func AssertFileExist(t *testing.T, file string)
- func AssertStringSlicesEqual(t *testing.T, input string, expected []string, actual []string)
- func AssertStringsEqual(t *testing.T, input string, expected string, actual string)
- func Check(err error, format string, a ...interface{})
- func CompressSlash(file string) string
- func Debugf(format string, a ...interface{})
- func DebugfForce(format string, a ...interface{})
- func Dump(prefix string, obj interface{})
- func Encode(args []string) string
- func Exit(success bool)
- func ExitFailure()
- func ExitSuccess()
- func Fatalf(format string, a ...interface{})
- func FilenameSafe(s string) string
- func FindZenlogBin() string
- func FindZenlogBinDir() string
- func Fingerprint() string
- func GetInjectedNow(clock utils.Clock) time.Time
- func GetIntEnv(name string, def int) int
- func GetSubcommand() (command string, args []string)
- func MustExec(args []string)
- func MustMarshal(v interface{}) string
- func MustUnmarshal(data string, v interface{})
- func NumLines(data []byte) int
- func PropagateTerminalSize(from *os.File, to *os.File) error
- func ReadFromFile(filename string, predicate func(vals []string) bool, timeout time.Duration) ([]string, error)
- func RunAndExit(f func() int)
- func Say(format string, a ...interface{})
- func SetOutputIsRaw(raw bool)
- func SlicesEqual(a []string, b []string) bool
- func StartEmergencyShell()
- func TryDecodeBytes(s []byte) (success bool, prefix []byte, args []string)
- func TryUnmarshal(data string, v interface{}) bool
- func Tty() string
- func Ttyname(fd uintptr) string
- func Warn(err error, format string, a ...interface{}) bool
- func WriteToFile(filename string, args []string) error
- func ZenlogBinCtime() time.Time
Constants ¶
This section is empty.
Variables ¶
var ( // Debug is whether the debug output is enabled or not. Debug = false )
Functions ¶
func AssertFileExist ¶
func AssertStringSlicesEqual ¶
func AssertStringsEqual ¶
func CompressSlash ¶
func DebugfForce ¶
func DebugfForce(format string, a ...interface{})
func Exit ¶
func Exit(success bool)
Exit should be used within RunAndExit to cleanly finishes the process.
func ExitFailure ¶
func ExitFailure()
ExitFailure should be used within RunAndExit to cleanly finishes the process with a failure code.
func ExitSuccess ¶
func ExitSuccess()
ExitSuccess should be used within RunAndExit to cleanly finishes the process with a success code.
func FilenameSafe ¶
func FindZenlogBin ¶
func FindZenlogBin() string
FindZenlogBin returns the fullpath of the zenlog executable.
func FindZenlogBinDir ¶
func FindZenlogBinDir() string
FindZenlogBinDir returns the fullpath of the directory where the zenlog executable is.
func GetInjectedNow ¶
GetInjectedNow returns an injected time if _ZENLOG_TIME_INJECTION_FILE is set, or otherwise just returns a passed Clock.
func GetSubcommand ¶
GetSubcommand extracts a zenlog subcommand name from os.Args.
func MustMarshal ¶
func MustMarshal(v interface{}) string
MustMarshal is a must version of json.Marshal.
func MustUnmarshal ¶
func MustUnmarshal(data string, v interface{})
MustUnmarshal is a must version of json.Unmarshal.
func ReadFromFile ¶
func ReadFromFile(filename string, predicate func(vals []string) bool, timeout time.Duration) ([]string, error)
ReadFromFile read encoded args from a file. The predicate callback can be used to tell whether a received set of args is what's expected or not.
func RunAndExit ¶
func RunAndExit(f func() int)
RunAndExit executes a given function. Within the function, util.Exit* functions can be used to finish the process cleanly.
func SetOutputIsRaw ¶
func SetOutputIsRaw(raw bool)
SetOutputIsRaw sets whether stdout is in raw mode or not.
func SlicesEqual ¶
func TryDecodeBytes ¶
TryDecodeBytes extracts a command string from a given string, and return the prefix part (i.e. the part followed by the command string) and the split up command arguments.
func TryUnmarshal ¶
TryUnmarshal is a json.Unmarshal wrapper that returns whether succeeded or not.
func WriteToFile ¶
WriteToFile writes encoded args to a file.
func ZenlogBinCtime ¶
ZenlogBinCtime returns the ctime of the zenlog executable.
Types ¶
This section is empty.