Documentation
¶
Index ¶
Constants ¶
View Source
const ( // LogLevel is the environment variable name for the log level. LogLevel = "LOG_LEVEL" DevLogLevel = "dev" TestLogLevel = "test" ProdLogLevel = "prod" )
Variables ¶
This section is empty.
Functions ¶
func GetLogLevel ¶ added in v0.12.1
func GetLogLevel() string
GetLogLevel reads LOG_LEVEL, falling back to dev when unset or unknown. A set-but-unknown value warns so the misconfiguration is not silent.
Types ¶
type Map ¶
Map is a map of environment variables. We use a *Var as map values are not addressable, i.e. cannot be modified directly.
type Var ¶
type Var struct {
Value string
DefaultValue string
IsInteger bool
IntValue int
IsBoolean bool
BooleanValue bool
OneOf []string
Optional bool // controls whether an env variable can be missing from the .env file but still declared
}
Var describes an environment variable and its configuration.
func NewLogLevelVar ¶ added in v0.16.0
func NewLogLevelVar() *Var
NewLogLevelVar returns the canonical LOG_LEVEL variable: defaults to dev. Deliberately not constrained via OneOf: an unknown value must not fail startup — consumers normalize it through GetLogLevel (warn + dev fallback), matching pre-OTel releases. Fresh *Var per call so Maps don't alias it.
Click to show internal directories.
Click to hide internal directories.