Documentation
¶
Index ¶
- func ComponentLogger(component string) *slog.Logger
- func FindLimit[T cmp.Ordered](x, y T) T
- func FindMemoryLimit(x, y string) int64
- func JobLogger(jobID string) *slog.Logger
- func LoadConfig(cfg interface{}) error
- func Logger() *slog.Logger
- func LoggerWith(attrs ...slog.Attr) *slog.Logger
- func ParseMemoryLimit(limit string) (int64, error)
- func SetupLogging()
- type ExecutorConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ComponentLogger ¶
ComponentLogger creates a logger with component attribute
func FindLimit ¶
FindLimit returns the minimum of two ordered values, treating zero values as "no limit". If either value is zero, it returns the non-zero value. If both are non-zero, it returns the minimum.
func FindMemoryLimit ¶
FindMemoryLimit parses two memory limit strings and returns the effective limit in bytes. It returns the smaller of the two limits, treating empty strings or parse errors as "no limit". This is useful for determining the effective memory limit when both global and local limits exist.
func LoadConfig ¶
func LoadConfig(cfg interface{}) error
LoadConfig loads configuration from environment variables and .env file. It will log warnings if the .env file cannot be loaded, but will not fail since environment variables may be provided directly.
func LoggerWith ¶
LoggerWith creates a logger with predefined attributes
func ParseMemoryLimit ¶
ParseMemoryLimit parses a memory limit string (e.g., "1G", "512M") and returns the value in bytes. Supported units are G/g (gigabytes) and M/m (megabytes).
func SetupLogging ¶
func SetupLogging()
setupLogging configures the logging level based on environment
Types ¶
type ExecutorConfig ¶
type ExecutorConfig struct {
// Executor is the executor to use for running the jobs (default: docker)
// Possible values: docker, k8s
Executor string `env:"HADES_EXECUTOR,notEmpty" envDefault:"docker"`
}
ExecutorConfig holds job executor configuration.