Skip to content

Commit 40966e9

Browse files
committed
Refactor timezone initialization logic in main function
1 parent 218aeca commit 40966e9

File tree

1 file changed

+2
-15
lines changed

1 file changed

+2
-15
lines changed

cmd/server/main.go

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -67,20 +67,8 @@ func main() {
6767
logger.WithCaller().Fatal("Failed to load configuration", logger.Args("error", err))
6868
}
6969

70-
// Initialize TimeZone and set time.Local
71-
if cfg.Server.TimeZone != "" && strings.ToUpper(cfg.Server.TimeZone) != "UTC" {
72-
loc, err := time.LoadLocation(cfg.Server.TimeZone)
73-
if err != nil {
74-
logger.Warn("Failed to load configured timezone, falling back to UTC",
75-
logger.Args("timezone", cfg.Server.TimeZone, "error", err))
76-
} else {
77-
time.Local = loc
78-
logger.Info("Dashboard timezone initialized", logger.Args("timezone", cfg.Server.TimeZone))
79-
}
80-
} else {
81-
// Ensure UTC if not specified or explicitly set to UTC
82-
time.Local = time.UTC
83-
logger.Info("Dashboard timezone set to UTC")
70+
if cfg.Server.TimeZone != "" {
71+
logger.Info("Dashboard display timezone configured", logger.Args("timezone", cfg.Server.TimeZone))
8472
}
8573

8674
// Apply configured log level from environment variable LOG_LEVEL (default: info)
@@ -342,4 +330,3 @@ func main() {
342330

343331
logger.Info("LogLynx stopped gracefully")
344332
}
345-

0 commit comments

Comments
 (0)