diff --git a/README.md b/README.md index e46a763..e00b05e 100644 --- a/README.md +++ b/README.md @@ -45,8 +45,8 @@ Everything else uses the standard library. │   └── dist.go ├── go.mod ├── go.sum -├── logger -│   └── logger.go +├── log +│   └── log.go ├── main.go ├── server │   ├── handler @@ -85,7 +85,7 @@ Note, the `dist/assets/css` will be ignored by `git` (configured in `.gitignore` files that are written to this directory are done by the Tailwind CSS CLI. Custom styles should go in the `styles/input.css` file. -### Logger +### Log This contains helper function to create a `slog.Logger`. diff --git a/logger/logger.go b/log/log.go similarity index 99% rename from logger/logger.go rename to log/log.go index bda1419..c184073 100644 --- a/logger/logger.go +++ b/log/log.go @@ -1,4 +1,4 @@ -package logger +package log import ( "log/slog" diff --git a/main.go b/main.go index 59037bc..b497ff0 100644 --- a/main.go +++ b/main.go @@ -3,37 +3,37 @@ package main import ( "context" "go-htmx-template/db" - "go-htmx-template/logger" + "go-htmx-template/log" "go-htmx-template/server" "go-htmx-template/server/router" "os" ) func main() { - log := logger.New( - logger.GetLevel(), - logger.GetOutput(), + logger := log.New( + log.GetLevel(), + log.GetOutput(), ) database, err := db.NewSQLite("./db.sqlite3") if err != nil { - log.Error("Failed to create database", "error", err) + logger.Error("Failed to create database", "error", err) os.Exit(1) } defer database.Close() err = db.InitSchema(context.Background(), database) if err != nil { - log.Error("Failed to initialize schema", "error", err) + logger.Error("Failed to initialize schema", "error", err) os.Exit(1) } queries := db.New(database) svr := server.New( - log, + logger, ":8080", - server.WithRouter(router.New(log, queries)), + server.WithRouter(router.New(logger, queries)), ) svr.StartAndWait()