Simplify logging

This commit is contained in:
2024-12-14 23:59:28 +01:00
parent 1ee8d94789
commit 71df436a93
4 changed files with 46 additions and 224 deletions

View File

@@ -1,8 +1,8 @@
package app
import (
"log/slog"
"net/http"
"novamd/internal/logging"
"github.com/go-chi/chi/v5"
)
@@ -11,7 +11,6 @@ import (
type Server struct {
router *chi.Mux
options *Options
logger *slog.Logger
}
// NewServer creates a new server instance with the given options
@@ -19,7 +18,6 @@ func NewServer(options *Options) *Server {
return &Server{
router: setupRouter(*options),
options: options,
logger: options.Logger.App(),
}
}
@@ -27,7 +25,7 @@ func NewServer(options *Options) *Server {
func (s *Server) Start() error {
// Start server
addr := ":" + s.options.Config.Port
s.logger.Info("Starting server", "address", addr)
logging.Info("Starting server", "address", addr)
return http.ListenAndServe(addr, s.router)
}