expand logging

This commit is contained in:
2025-05-18 18:25:17 -04:00
parent 028c084cdd
commit 72c0188071
8 changed files with 178 additions and 33 deletions

View File

@@ -5,6 +5,7 @@ import (
"os"
"git.dubyatp.xyz/chat-api-server/api"
"git.dubyatp.xyz/chat-api-server/log"
"github.com/joho/godotenv"
)
@@ -19,16 +20,15 @@ func checkEnvVars(keys []string) (bool, []string) {
}
func main() {
// Start logger
logger := slog.New(slog.NewJSONHandler(os.Stdout, nil))
slog.SetDefault(logger)
log.Logger() // initialize logger
requiredEnvVars := []string{"SCYLLA_CLUSTER", "SCYLLA_KEYSPACE"}
// Initialize dotenv file
err := godotenv.Load()
if err != nil {
logger.Info("No .env file loaded, will try OS environment variables")
slog.Info("No .env file loaded, will try OS environment variables")
}
// Check if environment variables were defined by the OS before erroring out