<commit_before>﻿using Serilog.Core;
using Serilog.Events;

namespace Umbraco.Core.Logging.SerilogExtensions
{
    /// <summary>
    /// This is used to create a new property in Logs called 'Log4NetLevel'
    /// So that we can map Serilog levels to Log4Net levels - so log files stay consistent
    /// </summary>
    public class Log4NetLevelMapperEnricher : ILogEventEnricher
    {
        public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory)
        {
            var log4NetLevel = string.Empty;

            switch (logEvent.Level)
            {
                case LogEventLevel.Debug:
                    log4NetLevel = "DEBUG";
                    break;

                case LogEventLevel.Error:
                    log4NetLevel = "ERROR";
                    break;

                case LogEventLevel.Fatal:
                    log4NetLevel = "FATAL";
                    break;

                case LogEventLevel.Information:
                    log4NetLevel = "INFO";
                    break;

                case LogEventLevel.Verbose:
                    log4NetLevel = "ALL";
                    break;

                case LogEventLevel.Warning:
                    log4NetLevel = "WARN";
                    break;
            }

            logEvent.AddPropertyIfAbsent(propertyFactory.CreateProperty("Log4NetLevel", log4NetLevel));
        }
    }
}<commit_msg>Bit of a hack - adds extra whitespace behind Log4Net Levels in our enricher so that they are all 5 characters in length and logfile aligns nicely as it used to in old Log4Net setup<commit_after>﻿using Serilog.Core;
using Serilog.Events;

namespace Umbraco.Core.Logging.SerilogExtensions
{
    /// <summary>
    /// This is used to create a new property in Logs called 'Log4NetLevel'
    /// So that we can map Serilog levels to Log4Net levels - so log files stay consistent
    /// </summary>
    public class Log4NetLevelMapperEnricher : ILogEventEnricher
    {
        public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory)
        {
            var log4NetLevel = string.Empty;

            switch (logEvent.Level)
            {
                case LogEventLevel.Debug:
                    log4NetLevel = "DEBUG";
                    break;

                case LogEventLevel.Error:
                    log4NetLevel = "ERROR";
                    break;

                case LogEventLevel.Fatal:
                    log4NetLevel = "FATAL";
                    break;

                case LogEventLevel.Information:
                    log4NetLevel = "INFO ";
                    break;

                case LogEventLevel.Verbose:
                    log4NetLevel = "ALL  ";
                    break;

                case LogEventLevel.Warning:
                    log4NetLevel = "WARN ";
                    break;
            }

            logEvent.AddPropertyIfAbsent(propertyFactory.CreateProperty("Log4NetLevel", log4NetLevel));
        }
    }
}
{'fraction_non_alphanumeric': 0.06764411862712429, 'fraction_numerical': 0.008997000999666778, 'mean_word_length': 1.472817133443163, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '2145334', 'n_tokens_mistral': 793, 'n_tokens_neox': 737, 'n_words': 197}