Files
Erupe/server/api/test_helpers.go
Houmgaor 06cb3afa57 refactor: standardize logging on zap across all packages
Replace all fmt.Printf/Println and log.Printf/Fatal with structured
zap.Logger calls to eliminate inconsistent logging (anti-pattern #12).

- network/crypt_conn: inject logger via NewCryptConn, replace 6 fmt calls
- signserver/session: use existing s.logger for debug packet dumps
- entranceserver: use s.logger for inbound/outbound debug logging
- api/utils: accept logger param in verifyPath, replace fmt.Println
- api/endpoints: use s.logger for screenshot path diagnostics
- config: replace log.Fatal with error return in getOutboundIP4
- deltacomp: replace log.Printf with zap.L() global logger
2026-02-20 18:59:12 +01:00

47 lines
1.1 KiB
Go

package api
import (
"testing"
_config "erupe-ce/config"
"go.uber.org/zap"
)
// NewTestLogger creates a logger for testing
func NewTestLogger(t *testing.T) *zap.Logger {
logger, err := zap.NewDevelopment()
if err != nil {
t.Fatalf("Failed to create test logger: %v", err)
}
return logger
}
// NewTestConfig creates a default test configuration
func NewTestConfig() *_config.Config {
return &_config.Config{
API: _config.API{
Port: 8000,
PatchServer: "http://localhost:8080",
Banners: []_config.APISignBanner{},
Messages: []_config.APISignMessage{},
Links: []_config.APISignLink{},
},
Screenshots: _config.ScreenshotsOptions{
Enabled: true,
OutputDir: "/tmp/screenshots",
UploadQuality: 85,
},
DebugOptions: _config.DebugOptions{
MaxLauncherHR: false,
},
GameplayOptions: _config.GameplayOptions{
MezFesSoloTickets: 100,
MezFesGroupTickets: 50,
MezFesDuration: 604800, // 1 week
MezFesSwitchMinigame: false,
},
LoginNotices: []string{"Welcome to Erupe!"},
HideLoginNotice: false,
}
}