<commit_before>﻿using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Serilog;

namespace TestWeb
{
    public class HomeController : Controller
    {
        private readonly ILogger<HomeController> _logger;
        private readonly ILoggerFactory _loggerFactory;

        public HomeController(ILogger<HomeController> logger, ILoggerFactory loggerFactory)
        {
            _logger = logger;
            _loggerFactory = loggerFactory;
        }

        public string Index()
        {
            Log.Information("Test info message with serilog");
            Log.Debug("Test debug message with serilog");

            _logger.LogInformation("Test info message with ILogger abstraction");
            _logger.LogDebug("Test debug message with ILogger abstraction");

            _logger.LogInformation(eventId: new Random().Next(), message: "Testing message with random event ID");
            _logger.LogInformation("Test message with List {list}", new List<string> { "foo", "123", "bar", "456" });
            _logger.LogInformation("Test message with Dictionary {dict}", new Dictionary<string, string>
            {
                { "myKey", "myValue" },
                { "mySecondKey", "withAValue" }
            });

            // ASP.NET Logger Factor accepts string log names, but these must follow the rules for Google Cloud logging:
            // https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry
            // Names must only include upper and lower case alphanumeric characters, forward-slash, underscore, hyphen, and period. No spaces!
            var logger = _loggerFactory.CreateLogger("AnotherLogger");
            logger.LogInformation("Test info message with ILoggerFactor abstraction and custom log name");

            return $"Logged messages, visit GCP log viewer at https://console.cloud.google.com/logs/viewer?project={Program.GCP_PROJECT_ID}";
        }
    }
}<commit_msg>cleanup log test<commit_after>﻿using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Serilog;

namespace TestWeb
{
    public class HomeController : Controller
    {
        private readonly ILogger<HomeController> _logger;
        private readonly ILoggerFactory _loggerFactory;

        public HomeController(ILogger<HomeController> logger, ILoggerFactory loggerFactory)
        {
            _logger = logger;
            _loggerFactory = loggerFactory;
        }

        public IActionResult Index()
        {
            Log.Information("Test info message with serilog");
            Log.Debug("Test debug message with serilog");

            _logger.LogInformation("Test info message with ILogger abstraction");
            _logger.LogDebug("Test debug message with ILogger abstraction");

            _logger.LogInformation(eventId: new Random().Next(), message: "Testing message with random event ID");
            _logger.LogInformation("Test message with List {list}", new List<string> { "foo", "123", "bar", "456" });
            _logger.LogInformation("Test message with Dictionary {dict}", new Dictionary<string, string>
            {
                { "myKey", "myValue" },
                { "mySecondKey", "withAValue" }
            });

            // ASP.NET Logger Factory accepts custom log names but these must follow the rules for Google Cloud logging:
            // https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry
            // Names must only include upper and lower case alphanumeric characters, forward-slash, underscore, hyphen, and period. No spaces!
            var logger = _loggerFactory.CreateLogger("AnotherLogger");
            logger.LogInformation("Test info message with ILoggerFactory abstraction and custom log name");

            var url = $"https://console.cloud.google.com/logs/viewer?project={Program.GCP_PROJECT_ID}";
            var page = $"<html><body>Logged messages, visit GCP log viewer at <a href='{url}'>{url}</a></body></html>";
            return Content(page, "text/html");
        }
    }
}
{'fraction_non_alphanumeric': 0.09966134494436381, 'fraction_numerical': 0.0038703434929850023, 'mean_word_length': 2.7353206865401987, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 4, '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': '4486525', 'n_tokens_mistral': 1049, 'n_tokens_neox': 1024, 'n_words': 306}