refactor: update logging configuration

Signed-off-by: Noste <83548733+Noooste@users.noreply.github.com>
This commit is contained in:
Noste
2026-01-18 20:36:10 +01:00
parent f6fe310e3e
commit 8f81c7ffea
15 changed files with 163 additions and 275 deletions
+5 -6
View File
@@ -21,17 +21,16 @@ var (
// Config holds logger configuration
type Config struct {
Level string // debug, info, warn, error
Pretty bool // Enable console pretty printing
TimeFormat string // Time format (default: time.RFC3339)
Level string // debug, info, warn, error
Format string // json, text
}
// Init initializes the global logger with the given configuration
func Init(cfg Config) {
var output io.Writer = os.Stdout
// Set up pretty console output if enabled
if cfg.Pretty {
// Set up console output for text format
if cfg.Format == "text" {
output = zerolog.ConsoleWriter{
Out: os.Stdout,
TimeFormat: time.RFC3339,
@@ -70,7 +69,7 @@ func Get() *Logger {
// Initialize with defaults if not initialized
Init(Config{
Level: "info",
Pretty: true,
Format: "text",
})
}
return globalLogger
-1
View File
@@ -91,5 +91,4 @@ func (c *Cache) cleanupExpired() {
}
}
// Global cache instance
var GlobalCache = NewCache()