config

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Env

func Env(key, defaultValue string) string

Env retrieves an environment variable with a default value

func EnvBool

func EnvBool(key string, defaultValue bool) bool

EnvBool retrieves an environment variable as boolean with a default value

func EnvInt

func EnvInt(key string, defaultValue int) int

EnvInt retrieves an environment variable as integer with a default value

func Get

func Get(key, fallback string) string

Get retrieves an environment variable with an optional fallback value

Types

type ChannelConfig

type ChannelConfig struct {
	Driver     string                 `json:"driver"`
	Level      string                 `json:"level"`
	Path       string                 `json:"path,omitempty"`
	MaxSize    int                    `json:"max_size,omitempty"`    // MB
	MaxAge     int                    `json:"max_age,omitempty"`     // days
	MaxBackups int                    `json:"max_backups,omitempty"` // number of old files
	Format     string                 `json:"format,omitempty"`      // json, text
	Options    map[string]interface{} `json:"options,omitempty"`     // driver-specific options
}

ChannelConfig defines configuration for a specific log channel

type LoggingConfig

type LoggingConfig struct {
	Default  string                   `json:"default"`
	Channels map[string]ChannelConfig `json:"channels"`
}

LoggingConfig defines the logging configuration structure

func GetLoggingConfig

func GetLoggingConfig() LoggingConfig

GetLoggingConfig returns the default logging configuration

func (LoggingConfig) GetChannel

func (c LoggingConfig) GetChannel(name string) (ChannelConfig, bool)

GetChannel returns a specific channel configuration

func (LoggingConfig) GetDefaultChannel

func (c LoggingConfig) GetDefaultChannel() (ChannelConfig, bool)

GetDefaultChannel returns the default channel configuration

Jump to

Keyboard shortcuts

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