Documentation
¶
Overview ¶
Package other contains various funtions that didn't fit into any of the other packages
Index ¶
- Variables
- func ConfigureLogging(logWriter io.Writer) map[string]zerolog.Level
- func Error(source, message string, err error) error
- func IntoPointer[T any](val T) *T
- func LoadConfigOrWriteDefault[T any](target, defaultValue T, filename string) error
- func LogLevelsFromFlag() map[string]zerolog.Level
- func Must[T any](val T, err error) T
- func NewLogger(extraLogWriter io.Writer) zerolog.Logger
- func OutputIntoChannel[T any](out T, target chan T)
- func SetupFlags()
Constants ¶
This section is empty.
Variables ¶
var ErrFileDidntExist = errors.New("file didn't exist")
Functions ¶
func ConfigureLogging ¶ added in v1.9.0
Configure logging. Utilises the flags setup in SetupFlags. If logWriter is not nil, will also write logs, as json objects, to the given writer
func Error ¶ added in v1.7.0
Error formats error messages to follow a common convention of "source: message: wrapped error"
func IntoPointer ¶
func IntoPointer[T any](val T) *T
IntoPointer returns a pointer to the given value
func LoadConfigOrWriteDefault ¶ added in v1.18.0
func LogLevelsFromFlag ¶ added in v1.17.2
Get the levels configured in the -loglevel cli flag. Root level is with the empty string key ("")
func Must ¶
Must is a quick wrapper to ensure that a function exits without error. If err is not nil, it panics. Otherwise val is returned. The intended use is something like Must(someFunc()), where someFunc has the signature someFunc() (T, error), with T being whatever type needed
func OutputIntoChannel ¶
func OutputIntoChannel[T any](out T, target chan T)
OutputIntoChannel takes a singular return value and sends it into the target channel. This is a wrapper for functions where a value can't be collected from directly. Example: goroutines
func SetupFlags ¶ added in v1.6.0
func SetupFlags()
Types ¶
This section is empty.