usvc

package module
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2023 License: Apache-2.0 Imports: 18 Imported by: 19

README

go-usvc

Checks GitHub Issues

Go Reference

Orignally a logging library with my opinions, rapidly becoming the microservice framework I didn't wanna write, with my opinions. Please see gokit or gomicro instead.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Global is a globally-scoped logger than can be used if you have no other choice
	Global logr.Logger
)

Functions

func BannerLog added in v0.0.4

func BannerLog(log logr.Logger, name, version, buildTime string)

BannerLog logs a few pieces of information about the programme; name, version, build time

func BannerStdout added in v0.0.4

func BannerStdout(name, version, buildTime string)

BannerStdout prints a short banner showing the programme name and version

func BannerStdoutLong added in v0.0.4

func BannerStdoutLong(name, version, buildTime string)

BannerStdoutLong prints a long banner detailing things about the programme's build and runtime environment

func ChannelWrapper

func ChannelWrapper(fn func() error) <-chan error

ChannelWrapper runs an error-returning func on a background goroutine. If the func returns an error, that is sent down the channel that's returned.

func DisableGoLog added in v0.0.7

func DisableGoLog()

func GetExeDir added in v0.0.4

func GetExeDir(log logr.Logger) string

GetExeDir returns the directory in which the running binary is located

func GetLogger

func GetLogger(devMode bool, options ...int) logr.Logger

GetLogger returns a zap-based zapr Logger, typed as a logr.Logger

func HomePath added in v0.0.4

func HomePath(path string) string

HomePath returns the absolute path to a given name in the current user's home directory

func InstallSignalHandlers

func InstallSignalHandlers(log logr.Logger) <-chan struct{}

InstallSignalHandlers registers handlers for common OS signals, and closes the returned channel if they're received.

func InterceptGoLog added in v0.0.7

func InterceptGoLog(l logr.Logger)

func MaxInt added in v0.0.6

func MaxInt[T constraints.Integer](x, y T) T

MaxInt returns the minimum value of two ints. Use math.Max for floats

func MinInt added in v0.0.6

func MinInt[T constraints.Integer](x, y T) T

MinInt returns the minimum value of two ints. Use math.Min for floats

func PrintUpdateLn added in v0.0.2

func PrintUpdateLn(s string)

PrintUpdateLn prints s to stdout. If stdout is connected to a terminal, it leaves the cursor at the end of the line and overwrites that line with any subsequent messages If stdout is not connected to a terminal, message are printed with newlines, just like fmt.Println() s should not contain any newline or other escape characters Calls to PrintUpdateLn should not be mixed with anything else that interacts with stdout

func SetLevel added in v0.0.3

func SetLevel(l int)

SetLevel sets the level of the entire tree of loggers returned from GetLogger

func Ternary added in v0.0.5

func Ternary[T any](test bool, yes, no T) T

Types

This section is empty.

Jump to

Keyboard shortcuts

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