Documentation ¶
Overview ¶
Inspired by github.com/wercker/journalhook (MIT license)
Index ¶
- Constants
- Variables
- func BuildVersion() string
- func DataSizeToUint64(size string) (uint64, error)
- func ExternalIDMiddleware(next echo.HandlerFunc) echo.HandlerFunc
- func GenerateOperationID() string
- func GetDepModuleInfoByPath(path string) (*debug.Module, error)
- func IsStringInSortedSlice(slice []string, s string) bool
- func LoggerMiddleware(next echo.HandlerFunc) echo.HandlerFunc
- func NopSeekCloser(r io.ReadSeeker) io.ReadSeekCloser
- func OperationIDMiddleware(next echo.HandlerFunc) echo.HandlerFunc
- func PanicOnError(err error)
- func ToPtr[T any](x T) *T
- type ContextHook
- type CustomJsonConversionError
- type CustomTypeError
- type EchoLogrusLogger
- func (l *EchoLogrusLogger) Debug(i ...interface{})
- func (l *EchoLogrusLogger) Debugf(format string, args ...interface{})
- func (l *EchoLogrusLogger) Debugj(j lslog.JSON)
- func (l *EchoLogrusLogger) Error(i ...interface{})
- func (l *EchoLogrusLogger) Errorf(format string, args ...interface{})
- func (l *EchoLogrusLogger) Errorj(j lslog.JSON)
- func (l *EchoLogrusLogger) Fatal(i ...interface{})
- func (l *EchoLogrusLogger) Fatalf(format string, args ...interface{})
- func (l *EchoLogrusLogger) Fatalj(j lslog.JSON)
- func (l *EchoLogrusLogger) Info(i ...interface{})
- func (l *EchoLogrusLogger) Infof(format string, args ...interface{})
- func (l *EchoLogrusLogger) Infoj(j lslog.JSON)
- func (l *EchoLogrusLogger) Level() lslog.Lvl
- func (l *EchoLogrusLogger) Output() io.Writer
- func (l *EchoLogrusLogger) Panic(i ...interface{})
- func (l *EchoLogrusLogger) Panicf(format string, args ...interface{})
- func (l *EchoLogrusLogger) Panicj(j lslog.JSON)
- func (l *EchoLogrusLogger) Prefix() string
- func (l *EchoLogrusLogger) Print(i ...interface{})
- func (l *EchoLogrusLogger) Printf(format string, args ...interface{})
- func (l *EchoLogrusLogger) Printj(j lslog.JSON)
- func (l *EchoLogrusLogger) SetHeader(h string)
- func (l *EchoLogrusLogger) SetLevel(v lslog.Lvl)
- func (l *EchoLogrusLogger) SetOutput(w io.Writer)
- func (l *EchoLogrusLogger) SetPrefix(p string)
- func (l *EchoLogrusLogger) Warn(i ...interface{})
- func (l *EchoLogrusLogger) Warnf(format string, args ...interface{})
- func (l *EchoLogrusLogger) Warnj(j lslog.JSON)
- func (l *EchoLogrusLogger) Write(p []byte) (n int, err error)
- type ImageBuildState
- type JournalHook
Constants ¶
const ( KiloByte = 1000 // kB KibiByte = 1024 // KiB MegaByte = 1000 * 1000 // MB MebiByte = 1024 * 1024 // MiB GigaByte = 1000 * 1000 * 1000 // GB GibiByte = 1024 * 1024 * 1024 // GiB TeraByte = 1000 * 1000 * 1000 * 1000 // TB TebiByte = 1024 * 1024 * 1024 * 1024 // TiB )
const ExternalIDKey string = "externalID"
const (
OSBuildImagesModulePath = "github.com/osbuild/images"
)
const OperationIDKey string = "operationID"
Variables ¶
var ( // Git revision from which this code was built GitRev = "undefined" // RPM Version RpmVersion = "undefined" )
These constants are set during buildtime using additional compiler flags. Not all of them are necessarily defined because RPMs can be build from a tarball and spec file without being in a git repository. On the other hand when building composer inside of a container, there is no RPM layer so in that case the RPM version doesn't exist at all.
Functions ¶
func BuildVersion ¶
func BuildVersion() string
func DataSizeToUint64 ¶
DataSizeToUint64 converts a size specified as a string in KB/KiB/MB/etc. to a number of bytes represented by uint64.
func ExternalIDMiddleware ¶
func ExternalIDMiddleware(next echo.HandlerFunc) echo.HandlerFunc
Extracts HTTP header X-External-Id and sets it as a request context value
func GenerateOperationID ¶
func GenerateOperationID() string
func GetDepModuleInfoByPath ¶
GetDepModuleInfoByPath returns the debug.Module for the dependency with the given path. If the dependency is not found, an error is returned.
func IsStringInSortedSlice ¶
IsStringInSortedSlice returns true if the string is present, false if not slice must be sorted
func LoggerMiddleware ¶
func LoggerMiddleware(next echo.HandlerFunc) echo.HandlerFunc
Store context in request logger to propagate correlation ids
func NopSeekCloser ¶
func NopSeekCloser(r io.ReadSeeker) io.ReadSeekCloser
NopSeekCloser returns an io.ReadSeekCloser with a no-op Close method wrapping the provided io.ReadSeeker r.
func OperationIDMiddleware ¶
func OperationIDMiddleware(next echo.HandlerFunc) echo.HandlerFunc
Adds a time-sortable globally unique identifier to an echo.Context if not already set
func PanicOnError ¶
func PanicOnError(err error)
Types ¶
type ContextHook ¶
type ContextHook struct{}
func (*ContextHook) Levels ¶
func (h *ContextHook) Levels() []logrus.Level
type CustomJsonConversionError ¶
type CustomJsonConversionError struct {
// contains filtered or unexported fields
}
CustomJsonConversionError is thrown when parsing strings into enumerations
func (*CustomJsonConversionError) Error ¶
func (err *CustomJsonConversionError) Error() string
Error returns the error as a string
type CustomTypeError ¶
type CustomTypeError struct {
// contains filtered or unexported fields
}
CustomTypeError is thrown when parsing strings into enumerations
func (*CustomTypeError) Error ¶
func (err *CustomTypeError) Error() string
Error returns the error as a string
type EchoLogrusLogger ¶
EchoLogrusLogger extend logrus.Logger
func Logger ¶
func Logger() *EchoLogrusLogger
func (*EchoLogrusLogger) Debug ¶
func (l *EchoLogrusLogger) Debug(i ...interface{})
func (*EchoLogrusLogger) Debugf ¶
func (l *EchoLogrusLogger) Debugf(format string, args ...interface{})
func (*EchoLogrusLogger) Debugj ¶
func (l *EchoLogrusLogger) Debugj(j lslog.JSON)
func (*EchoLogrusLogger) Error ¶
func (l *EchoLogrusLogger) Error(i ...interface{})
func (*EchoLogrusLogger) Errorf ¶
func (l *EchoLogrusLogger) Errorf(format string, args ...interface{})
func (*EchoLogrusLogger) Errorj ¶
func (l *EchoLogrusLogger) Errorj(j lslog.JSON)
func (*EchoLogrusLogger) Fatal ¶
func (l *EchoLogrusLogger) Fatal(i ...interface{})
func (*EchoLogrusLogger) Fatalf ¶
func (l *EchoLogrusLogger) Fatalf(format string, args ...interface{})
func (*EchoLogrusLogger) Fatalj ¶
func (l *EchoLogrusLogger) Fatalj(j lslog.JSON)
func (*EchoLogrusLogger) Info ¶
func (l *EchoLogrusLogger) Info(i ...interface{})
func (*EchoLogrusLogger) Infof ¶
func (l *EchoLogrusLogger) Infof(format string, args ...interface{})
func (*EchoLogrusLogger) Infoj ¶
func (l *EchoLogrusLogger) Infoj(j lslog.JSON)
func (*EchoLogrusLogger) Level ¶
func (l *EchoLogrusLogger) Level() lslog.Lvl
func (*EchoLogrusLogger) Output ¶
func (l *EchoLogrusLogger) Output() io.Writer
func (*EchoLogrusLogger) Panic ¶
func (l *EchoLogrusLogger) Panic(i ...interface{})
func (*EchoLogrusLogger) Panicf ¶
func (l *EchoLogrusLogger) Panicf(format string, args ...interface{})
func (*EchoLogrusLogger) Panicj ¶
func (l *EchoLogrusLogger) Panicj(j lslog.JSON)
func (*EchoLogrusLogger) Prefix ¶
func (l *EchoLogrusLogger) Prefix() string
func (*EchoLogrusLogger) Print ¶
func (l *EchoLogrusLogger) Print(i ...interface{})
func (*EchoLogrusLogger) Printf ¶
func (l *EchoLogrusLogger) Printf(format string, args ...interface{})
func (*EchoLogrusLogger) Printj ¶
func (l *EchoLogrusLogger) Printj(j lslog.JSON)
func (*EchoLogrusLogger) SetHeader ¶
func (l *EchoLogrusLogger) SetHeader(h string)
func (*EchoLogrusLogger) SetLevel ¶
func (l *EchoLogrusLogger) SetLevel(v lslog.Lvl)
func (*EchoLogrusLogger) SetOutput ¶
func (l *EchoLogrusLogger) SetOutput(w io.Writer)
func (*EchoLogrusLogger) SetPrefix ¶
func (l *EchoLogrusLogger) SetPrefix(p string)
func (*EchoLogrusLogger) Warn ¶
func (l *EchoLogrusLogger) Warn(i ...interface{})
func (*EchoLogrusLogger) Warnf ¶
func (l *EchoLogrusLogger) Warnf(format string, args ...interface{})
func (*EchoLogrusLogger) Warnj ¶
func (l *EchoLogrusLogger) Warnj(j lslog.JSON)
type ImageBuildState ¶
type ImageBuildState int
const ( IBWaiting ImageBuildState = iota IBRunning IBFinished IBFailed )
func (ImageBuildState) MarshalJSON ¶
func (ibs ImageBuildState) MarshalJSON() ([]byte, error)
func (ImageBuildState) ToString ¶
func (ibs ImageBuildState) ToString() string
ToString converts ImageBuildState into a human readable string
func (*ImageBuildState) UnmarshalJSON ¶
func (ibs *ImageBuildState) UnmarshalJSON(data []byte) error
UnmarshalJSON converts a JSON string into an ImageBuildState
type JournalHook ¶
type JournalHook struct{}
func (*JournalHook) Levels ¶
func (hook *JournalHook) Levels() []logrus.Level