package logging

import (
	"io"
	"log/slog"
)

// nopLogger is a singleton nop logger.
var nopLogger *Logger

// Nop returns a no-op logger that discards all output.
// Useful for testing or when logging is disabled.
func Nop() *Logger {
	if nopLogger == nil {
		handler := slog.NewJSONHandler(io.Discard, &slog.HandlerOptions{
			Level: slog.LevelError + 1, // Higher than any level, so nothing logs
		})
		nopLogger = &Logger{
			Logger: slog.New(handler),
			config: DefaultConfig(),
		}
	}
	return nopLogger
}
