package observability

import (
	"log/slog"
	"os"
)

// NewLogger creates a structured JSON logger writing to stdout.
// In debug mode, it enables verbose probe payloads, SQL queries, and
// classification reasoning.
func NewLogger(debug bool) *slog.Logger {
	level := slog.LevelInfo
	if debug {
		level = slog.LevelDebug
	}

	handler := slog.NewJSONHandler(os.Stdout, &slog.HandlerOptions{
		Level: level,
	})

	logger := slog.New(handler).With("service", "oikos")
	return logger
}
