diff options
| author | Bobby <[email protected]> | 2026-02-04 16:45:42 +0530 |
|---|---|---|
| committer | Bobby <[email protected]> | 2026-02-04 16:45:42 +0530 |
| commit | 61928ff31d2f8ed00b715a2affd7d9fc58a65a13 (patch) | |
| tree | c5ec2f96b2971d333ff2ecad37415317c3161d91 | |
| parent | b7926ef0546d8906814bcda5741e45b3498f4332 (diff) | |
| download | metachan-61928ff31d2f8ed00b715a2affd7d9fc58a65a13.tar.xz metachan-61928ff31d2f8ed00b715a2affd7d9fc58a65a13.zip | |
Refactor server startup: improve logging with structured messages and use server host and port configuration
| -rw-r--r-- | metachan/main.go | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/metachan/main.go b/metachan/main.go index 3892060..5df2bc0 100644 --- a/metachan/main.go +++ b/metachan/main.go @@ -15,6 +15,7 @@ import ( ) func main() { + logger.Init() database.AutoMigrate() tasks.GlobalTaskManager.StartAllTasks() @@ -36,16 +37,9 @@ func main() { router.Initialize(app) // Start the server - if err := app.Listen(fmt.Sprintf(":%d", config.Config.Port)); err != nil { - logger.Log(fmt.Sprintf("Failed to the start the server on port %d: %v", config.Config.Port, err), logger.LogOptions{ - Prefix: "Main", - Level: logger.Error, - Fatal: true, - }) + if err := app.Listen(fmt.Sprintf("%s:%d", config.Server.Host, config.Server.Port)); err != nil { + logger.Fatalf("Main", "Failed to the start the server on %s:%d: %v", config.Server.Host, config.Server.Port, err) } - logger.Log(fmt.Sprintf("Server started on port %d", config.Config.Port), logger.LogOptions{ - Prefix: "Main", - Level: logger.Success, - }) + logger.Successf("Main", "Server started on %s:%d", config.Server.Host, config.Server.Port) } |
