config

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateLoggerFromConfig

func CreateLoggerFromConfig(v *viper.Viper) log.Logger

CreateLoggerFromConfig creates a logger based on viper configuration

func NewConfig

func NewConfig() *viper.Viper

Types

type ConsoleLoggerConfig

type ConsoleLoggerConfig struct {
	Enabled    bool `yaml:"enabled" json:"enabled"`
	Colors     bool `yaml:"colors" json:"colors"`
	JsonFormat bool `yaml:"json_format" json:"json_format"`
}

ConsoleLoggerConfig contains configuration for console logging

type FileLoggerConfig

type FileLoggerConfig struct {
	Enabled    bool   `yaml:"enabled" json:"enabled"`
	Filename   string `yaml:"filename" json:"filename"`
	Directory  string `yaml:"directory" json:"directory"` // Directory where log files will be created
	JsonFormat bool   `yaml:"json_format" json:"json_format"`
	MaxSize    int    `yaml:"max_size" json:"max_size"`
	MaxBackups int    `yaml:"max_backups" json:"max_backups"`
	MaxAge     int    `yaml:"max_age" json:"max_age"`
	Compress   bool   `yaml:"compress" json:"compress"`
}

FileLoggerConfig contains configuration for file logging with rotation

type LogConfig

type LogConfig struct {
	Level         string              `yaml:"level" json:"level"`
	ConsoleLogger ConsoleLoggerConfig `yaml:"console_logger" json:"console_logger"`
	FileLogger    FileLoggerConfig    `yaml:"file_logger" json:"file_logger"`
}

LogConfig represents the complete logger configuration Design is extensible - new logger configs can be added here

Jump to

Keyboard shortcuts

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