summaryrefslogtreecommitdiffstats
path: root/cmd/web/main.go
diff options
context:
space:
mode:
authorMatthew Lemon <y@yulqen.org>2024-04-22 14:30:08 +0100
committerMatthew Lemon <y@yulqen.org>2024-04-22 14:30:08 +0100
commit979680b2b8fcb0acdf7b9c776bf6e857259c3309 (patch)
tree58e9e646950efdf934eb287616dfe911a0237dd7 /cmd/web/main.go
parentdab6b649e3a72a21504581de3bfd57006f366427 (diff)
Changed to 1.20 and using RHEL9 Go image
- Using RHEL image registry and Go toolset image (https://catalog.redhat.com/software/containers/rhel9/go-toolset/61df08166d9a1b7b2aab2344?image=6613b725036e65b1bc748a3f&architecture=amd64&container-tabs=packages) - Changed Go version to 1.20 to accommodate image - Removed structured logger
Diffstat (limited to '')
-rw-r--r--cmd/web/main.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/cmd/web/main.go b/cmd/web/main.go
index 5f4bfdf..bce1f1a 100644
--- a/cmd/web/main.go
+++ b/cmd/web/main.go
@@ -4,7 +4,7 @@ import (
"database/sql"
"flag"
"html/template"
- "log/slog"
+ "log"
"net/http"
"os"
@@ -14,7 +14,7 @@ import (
)
type application struct {
- logger *slog.Logger
+ logger *log.Logger
operations *models.OperationModel
organisations *models.OrganisationModel
persons *models.PersonModel
@@ -29,7 +29,7 @@ func main() {
//dsn := flag.String("dsn", "postgresql://postgres:secret@ded-db?sslmode=disable", "PostgreSQL data source name")
flag.Parse()
- logger := slog.New(slog.NewTextHandler(os.Stdout, nil))
+ logger := log.New(os.Stdout, "ded-web: ", log.LstdFlags)
// Database connection
//db, err := openDB(*dsn)
@@ -43,7 +43,7 @@ func main() {
// initialise the new template cache...
templateCache, err := newTemplateCache()
if err != nil {
- logger.Error(err.Error())
+ logger.Println(err.Error())
os.Exit(1)
}
@@ -59,9 +59,9 @@ func main() {
// mux := http.NewServeMux()
// mux.HandleFunc("/", home)
// log.Print("starting server on :4000")
- logger.Info("starting server", "addr", *addr)
+ logger.Printf("starting server", addr)
err = http.ListenAndServe(*addr, app.routes())
- logger.Error(err.Error())
+ logger.Println(err.Error())
os.Exit(1)
}