fix: improve logging in routines

This commit is contained in:
Stavros
2026-05-08 17:43:20 +03:00
parent 0958c3b864
commit b73a9db061
8 changed files with 21 additions and 14 deletions
+3 -1
View File
@@ -252,7 +252,7 @@ func (app *BootstrapApp) Setup() error {
for {
select {
case <-app.ctx.Done():
app.log.App.Debug().Msg("Oh, seems like I got to shutdown, bye!")
app.log.App.Info().Msg("Oh, seems like I got to shutdown, bye!")
app.db.Close()
return nil
case err := <-errChan:
@@ -410,6 +410,8 @@ func (app *BootstrapApp) dbCleanupRoutine() {
if err != nil {
app.log.App.Error().Err(err).Msg("Failed to delete expired sessions")
}
app.log.App.Debug().Msg("Database cleanup completed")
case <-app.ctx.Done():
app.log.App.Debug().Msg("Stopping database cleanup routine")
ticker.Stop()
+2 -7
View File
@@ -2,21 +2,16 @@ package bootstrap
import (
"fmt"
"slices"
"github.com/tinyauthapp/tinyauth/internal/controller"
"github.com/tinyauthapp/tinyauth/internal/middleware"
"github.com/tinyauthapp/tinyauth/internal/model"
"github.com/gin-gonic/gin"
)
var DEV_MODES = []string{"main", "test", "development"}
func (app *BootstrapApp) setupRouter() error {
if !slices.Contains(DEV_MODES, model.Version) {
gin.SetMode(gin.ReleaseMode)
}
// we don't want gin debug mode
gin.SetMode(gin.ReleaseMode)
engine := gin.New()
engine.Use(gin.Recovery())