File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ var instance *DB
1919
2020// Connect establishes a connection to the database using centralized configuration
2121func Connect () (* DB , error ) {
22+ logger := config .SetupLogger ()
2223 cfg := config .Get ()
2324 dbCfg := cfg .Database
2425
@@ -46,8 +47,7 @@ func Connect() (*DB, error) {
4647 return nil , fmt .Errorf ("failed to ping database: %w" , err )
4748 }
4849
49- log .Printf ("Successfully connected to database: %s@%s:%d/%s" ,
50- dbCfg .User , dbCfg .Host , dbCfg .Port , dbCfg .Name )
50+ logger .Info ("Connected to database successfully" )
5151
5252 return & DB {db }, nil
5353}
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ package main
22
33import (
44 "context"
5+ "fmt"
56 "log"
67 "os"
78 "os/signal"
@@ -51,7 +52,8 @@ func main() {
5152
5253 // Minimal config info in development mode
5354 if cfg .IsDevelopment () {
54- log .Printf ("Development mode - %s:%s" , cfg .AppName , cfg .Port )
55+ message := fmt .Sprintf ("Running in development mode: %s on port %s" , cfg .AppName , cfg .Port )
56+ logger .Info (message )
5557 }
5658
5759 logger .Info ("Starting application" ,
You can’t perform that action at this time.
0 commit comments