mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-22 07:32:32 +01:00
feat(logs): by default, log server activity to a file.
This commit is contained in:
@@ -27,6 +27,7 @@ type Config struct {
|
||||
|
||||
DevModeOptions DevModeOptions
|
||||
GameplayOptions GameplayOptions
|
||||
Logging Logging
|
||||
Discord Discord
|
||||
Commands []Command
|
||||
Courses []Course
|
||||
@@ -73,6 +74,16 @@ type GameplayOptions struct {
|
||||
DailyQuestAllowance uint32 // Number of Daily Quests to allow daily
|
||||
}
|
||||
|
||||
// Logging holds the logging configuration.
|
||||
type Logging struct {
|
||||
LogToFile bool // Enable/disable file logging (default: true)
|
||||
LogFilePath string // File path for logs (default: "logs/erupe.log")
|
||||
LogMaxSize int // Max size in MB before rotation (default: 100)
|
||||
LogMaxBackups int // Number of old log files to keep (default: 3)
|
||||
LogMaxAge int // Max days to retain old logs (default: 28)
|
||||
LogCompress bool // Compress rotated logs (default: true)
|
||||
}
|
||||
|
||||
// Discord holds the discord integration config.
|
||||
type Discord struct {
|
||||
Enabled bool
|
||||
@@ -197,6 +208,15 @@ func LoadConfig() (*Config, error) {
|
||||
OutputDir: "savedata",
|
||||
})
|
||||
|
||||
viper.SetDefault("Logging", Logging{
|
||||
LogToFile: true,
|
||||
LogFilePath: "logs/erupe.log",
|
||||
LogMaxSize: 100,
|
||||
LogMaxBackups: 3,
|
||||
LogMaxAge: 28,
|
||||
LogCompress: true,
|
||||
})
|
||||
|
||||
err := viper.ReadInConfig()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
Reference in New Issue
Block a user