<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Threading;
using System.Data.SqlClient;
using System.Configuration;

namespace Oak
{
    public static class BootStrap
    {
        public static void Init()
        {
            ModelBinders.Binders.Add(new KeyValuePair<Type, IModelBinder>(typeof(object), new ParamsModelBinder()));
        }
    }

    public static class DebugBootStrap
    {
        [ThreadStatic]
        public static List<SqlQueryLog> SqlQueries = new List<SqlQueryLog>();

        public static List<Recommendation> Recommendations = new List<Recommendation>();

        public static void Init(HttpApplication mvcApplication)
        {
            if (!IsInDebugMode()) return;

            Recommendations = new List<Recommendation> 
            {
                new CreateDbRecommendation(),
                new CreateTableRecommendation(),
                new FirstTimeRecommendation(),
                new NoDefinitionOnGeminiRecommendation(),
                new NoDefinitionOnDerivedGeminiRecommendation(),
                new InvalidColumnRecommendation()
            };

            mvcApplication.EndRequest += PrintInefficientQueries;

            Massive.DynamicRepository.WriteDevLog = true;

            Massive.DynamicRepository.LogSql = (sender, query, args) =>
            {
                lock (Massive.DynamicRepository.ConsoleLogLock)
                {
                    if (SqlQueries == null) SqlQueries = new List<SqlQueryLog>();

                    SqlQueries.Add(
                        new SqlQueryLog(sender,
                            query,
                            Environment.StackTrace,
                            Thread.CurrentThread.ManagedThreadId,
                            args));
                }
            };

            mvcApplication.Error += WriteHelpfulError(mvcApplication);
        }<commit_msg>added console out for post data<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Threading;
using System.Data.SqlClient;
using System.Configuration;

namespace Oak
{
    public static class BootStrap
    {
        public static void Init()
        {
            ModelBinders.Binders.Add(new KeyValuePair<Type, IModelBinder>(typeof(object), new ParamsModelBinder()));
        }
    }

    public static class DebugBootStrap
    {
        [ThreadStatic]
        public static List<SqlQueryLog> SqlQueries = new List<SqlQueryLog>();

        public static List<Recommendation> Recommendations = new List<Recommendation>();

        public static void Init(HttpApplication mvcApplication)
        {
            if (!IsInDebugMode()) return;

            Recommendations = new List<Recommendation> 
            {
                new CreateDbRecommendation(),
                new CreateTableRecommendation(),
                new FirstTimeRecommendation(),
                new NoDefinitionOnGeminiRecommendation(),
                new NoDefinitionOnDerivedGeminiRecommendation(),
                new InvalidColumnRecommendation()
            };

            mvcApplication.EndRequest += PrintInefficientQueries;

            mvcApplication.BeginRequest += (sender, e) =>
            {
                if (mvcApplication.Request.Form != null && mvcApplication.Request.Form.Count > 0)
                {
                    lock (Massive.DynamicRepository.ConsoleLogLock)
                    {
                        Console.Out.WriteLine("\n\n============ Form that was posted ==========");
                        Console.Out.WriteLine("For thread: " + Thread.CurrentThread.ManagedThreadId + "\n");
                        Console.Out.WriteLine(new DynamicParams(mvcApplication.Request.Form, null));
                        Console.Out.WriteLine("===============================================\n");
                    }
                }
            };

            Massive.DynamicRepository.WriteDevLog = true;

            Massive.DynamicRepository.LogSql = (sender, query, args) =>
            {
                lock (Massive.DynamicRepository.ConsoleLogLock)
                {
                    if (SqlQueries == null) SqlQueries = new List<SqlQueryLog>();

                    SqlQueries.Add(
                        new SqlQueryLog(sender,
                            query,
                            Environment.StackTrace,
                            Thread.CurrentThread.ManagedThreadId,
                            args));
                }
            };

            mvcApplication.Error += WriteHelpfulError(mvcApplication);
        }
{'fraction_non_alphanumeric': 0.09444798978940651, 'fraction_numerical': 0.00021272069772388852, 'mean_word_length': 1.7577712609970675, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4365862', 'n_tokens_mistral': 1162, 'n_tokens_neox': 1078, 'n_words': 220}