package common import ( "log/slog" "os" ) var logger *slog.Logger func GetLog(prefix string) *slog.Logger { initLog(prefix) return logger } func initLog(prefix string) { textHandler := slog.NewJSONHandler(os.Stdout, &slog.HandlerOptions{ AddSource: true, Level: slog.LevelDebug, }).WithAttrs([]slog.Attr{slog.String("module", prefix)}) logger = slog.New(textHandler) }