Documentation
¶
Index ¶
- func DefaultLogWriter(version string) io.Writer
- func GetDefaultConfigDir() string
- func InitDefaultLogger(version string)
- func WriteDefaultConfig(path string) error
- type AppConfig
- func (c *AppConfig) ApplyLogConfig() error
- func (c *AppConfig) GetConfigDir() string
- func (c *AppConfig) GetDataDir() string
- func (c *AppConfig) GetDatabasePath() string
- func (c *AppConfig) GetEncryptionKey() []byte
- func (c *AppConfig) GetLockedLogSettings() map[string]string
- func (c *AppConfig) GetLogManager() *LogManager
- func (c *AppConfig) GetLogSettings() LogSettingsResponse
- func (c *AppConfig) PersistLogSettings(level, path string, maxSize, maxBackups int) error
- func (c *AppConfig) RegisterReloadListener(fn func(*domain.Config))
- func (c *AppConfig) ResolveLogPath(logPath string) string
- func (c *AppConfig) SetDataDir(dir string)
- func (c *AppConfig) UpdateLogSettings(update LogSettingsUpdate) (LogSettingsResponse, error)
- type LogManager
- type LogSettingsResponse
- type LogSettingsUpdate
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultLogWriter ¶ added in v1.1.0
DefaultLogWriter returns the base log writer for the provided version.
func GetDefaultConfigDir ¶ added in v0.3.0
func GetDefaultConfigDir() string
GetDefaultConfigDir returns the OS-specific config directory
func InitDefaultLogger ¶ added in v1.1.0
func InitDefaultLogger(version string)
InitDefaultLogger configures zerolog with the default writer for this version. This is used by CLI entry points before a configuration file is loaded.
func WriteDefaultConfig ¶ added in v0.3.0
Types ¶
type AppConfig ¶
func (*AppConfig) ApplyLogConfig ¶
func (*AppConfig) GetConfigDir ¶ added in v1.3.0
GetConfigDir returns the directory containing the config file
func (*AppConfig) GetDataDir ¶
GetDataDir returns the resolved data directory path.
func (*AppConfig) GetDatabasePath ¶
GetDatabasePath returns the path to the database file
func (*AppConfig) GetEncryptionKey ¶
GetEncryptionKey derives a 32-byte encryption key from the session secret
func (*AppConfig) GetLockedLogSettings ¶ added in v1.12.0
GetLockedLogSettings returns a map of log setting keys that are locked by env/CLI.
func (*AppConfig) GetLogManager ¶ added in v1.12.0
func (c *AppConfig) GetLogManager() *LogManager
GetLogManager returns the LogManager for log streaming.
func (*AppConfig) GetLogSettings ¶ added in v1.12.0
func (c *AppConfig) GetLogSettings() LogSettingsResponse
GetLogSettings returns the current log settings with locked field information. The Path field is resolved to an absolute path (relative paths are resolved against the config directory).
func (*AppConfig) PersistLogSettings ¶ added in v1.12.0
PersistLogSettings atomically updates only the log-related keys in config.toml. It preserves all other content and comments.
func (*AppConfig) RegisterReloadListener ¶ added in v1.0.0
RegisterReloadListener registers a callback that's invoked when the configuration file is reloaded.
func (*AppConfig) ResolveLogPath ¶ added in v1.12.0
ResolveLogPath resolves a log path, making relative paths relative to the config directory. Returns empty string if logPath is empty (stdout only).
func (*AppConfig) SetDataDir ¶
SetDataDir sets the data directory (used by CLI flags)
func (*AppConfig) UpdateLogSettings ¶ added in v1.12.0
func (c *AppConfig) UpdateLogSettings(update LogSettingsUpdate) (LogSettingsResponse, error)
UpdateLogSettings validates and applies log settings updates. It rejects changes to locked fields and returns an error if any locked field is modified.
type LogManager ¶ added in v1.12.0
type LogManager struct {
// contains filtered or unexported fields
}
LogManager handles log configuration with safe runtime reconfiguration.
func NewLogManager ¶ added in v1.12.0
func NewLogManager(version string) *LogManager
NewLogManager creates a new LogManager with the given version string.
func (*LogManager) Apply ¶ added in v1.12.0
func (lm *LogManager) Apply(level, logPath string, maxSize, maxBackups int) error
Apply updates the log configuration with the given settings. It is safe to call this method concurrently from multiple goroutines. Returns an error if file logging is requested but cannot be enabled.
func (*LogManager) GetHub ¶ added in v1.12.0
func (lm *LogManager) GetHub() *logstream.Hub
GetHub returns the log streaming hub for SSE endpoints.
func (*LogManager) Initialize ¶ added in v1.12.0
func (lm *LogManager) Initialize()
Initialize sets up the global logger to use the switchable writer. This should only be called once during application startup.
type LogSettingsResponse ¶ added in v1.12.0
type LogSettingsResponse struct {
Level string `json:"level"`
Path string `json:"path"`
MaxSize int `json:"maxSize"`
MaxBackups int `json:"maxBackups"`
ConfigPath string `json:"configPath,omitempty"`
Locked map[string]string `json:"locked,omitempty"`
}
LogSettingsResponse represents the log settings for API responses.
type LogSettingsUpdate ¶ added in v1.12.0
type LogSettingsUpdate struct {
Level *string `json:"level,omitempty"`
Path *string `json:"path,omitempty"`
MaxSize *int `json:"maxSize,omitempty"`
MaxBackups *int `json:"maxBackups,omitempty"`
}
LogSettingsUpdate represents a request to update log settings.