Skip to content

Commit 8c9f279

Browse files
committed
Change the format for a failed connection to db
switched the error message func from the fmt pkg to the log pkg since log.Printf prints to stderr by default.
1 parent 967601f commit 8c9f279

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

internal/backend/backend.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package backend
22

33
import (
44
"context"
5-
"fmt"
5+
"log"
66
"os"
77

88
"github.com/jackc/pgx/v5/pgxpool"
@@ -15,7 +15,7 @@ func Connect() (context.Context, *pgxpool.Pool) {
1515
dbURL := os.Getenv("DATABASE_URL")
1616
conn, err := pgxpool.New(ctx, dbURL)
1717
if err != nil {
18-
fmt.Fprintf(os.Stderr, "Unable to connect to database: %v\n", err)
18+
log.Printf("Unable to connect to database: %s\n", err.Error())
1919
os.Exit(1)
2020
}
2121

0 commit comments

Comments
 (0)