other

package
v1.18.1 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2025 License: MIT Imports: 13 Imported by: 1

Documentation

Overview

Package other contains various funtions that didn't fit into any of the other packages

Index

Constants

This section is empty.

Variables

View Source
var ErrFileDidntExist = errors.New("file didn't exist")

Functions

func ConfigureLogging added in v1.9.0

func ConfigureLogging(logWriter io.Writer) map[string]zerolog.Level

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

func Error(source, message string, err error) error

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 LoadConfigOrWriteDefault[T any](target, defaultValue T, filename string) error

func LogLevelsFromFlag added in v1.17.2

func LogLevelsFromFlag() map[string]zerolog.Level

Get the levels configured in the -loglevel cli flag. Root level is with the empty string key ("")

func Must

func Must[T any](val T, err error) T

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 NewLogger added in v1.17.2

func NewLogger(extraLogWriter io.Writer) zerolog.Logger

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.

Jump to

Keyboard shortcuts

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