<commit_before>using System;
using System.Reflection;
using System.Text;
using log4net;

namespace SharpArchContrib.Core.Logging {
    public class MethodLogger : IMethodLogger {
        private readonly IExceptionLogger exceptionLogger;

        public MethodLogger(IExceptionLogger exceptionLogger) {
            ParameterCheck.ParameterRequired(exceptionLogger, "exceptionLogger");

            this.exceptionLogger = exceptionLogger;
        }

        #region IMethodLogger Members

        public void LogEntry(MethodBase methodBase, object[] argumentValues, LoggingLevel entryLevel) {
            ILog logger = LogManager.GetLogger(methodBase.DeclaringType);
            if (ShouldLog(logger, entryLevel, methodBase)) {
                var logMessage = new StringBuilder();
                logMessage.Append(string.Format("{0}(", methodBase.Name));

                ParameterInfo[] parameterInfos = methodBase.GetParameters();
                if (argumentValues != null && parameterInfos != null) {
                    for (int i = 0; i < argumentValues.Length; i++) {
                        if (i > 0) {
                            logMessage.Append(" ");
                        }
                        logMessage.Append(string.Format("{0}:[{1}]", parameterInfos[i].Name, argumentValues[i]));
                    }
                }
                logMessage.Append(")");
                logger.Log(entryLevel, logMessage.ToString());
            }
        }

        public void LogSuccess(MethodBase methodBase, object returnValue, LoggingLevel successLevel) {
            ILog logger = LogManager.GetLogger(methodBase.DeclaringType);
            if (ShouldLog(logger, successLevel, methodBase)) {
                logger.Log(LoggingLevel.Debug,
                           string.Format("{0} Returns:[{1}]", methodBase.Name,
                                         returnValue != null ? returnValue.ToString() : ""));
            }
        }

        public void LogException(MethodBase methodBase, Exception err, LoggingLevel exceptionLevel) {
            ILog logger = LogManager.GetLogger(methodBase.DeclaringType);
            if (ShouldLog(logger, exceptionLevel, methodBase)) {
                exceptionLogger.LogException(err, false, methodBase.DeclaringType);
            }
        }

        #endregion

        private bool ShouldLog(ILog logger, LoggingLevel loggingLevel, MethodBase methodBase) {
            if (methodBase != null && methodBase.Name != null) {
                return logger.IsEnabledFor(loggingLevel);
            }

            return false;
        }
    }
}<commit_msg>Closes #2<commit_after>using System;
using System.Reflection;
using System.Text;
using log4net;

namespace SharpArchContrib.Core.Logging {
    public class MethodLogger : IMethodLogger {
        private readonly IExceptionLogger exceptionLogger;

        public MethodLogger(IExceptionLogger exceptionLogger) {
            ParameterCheck.ParameterRequired(exceptionLogger, "exceptionLogger");

            this.exceptionLogger = exceptionLogger;
        }

        #region IMethodLogger Members

        public void LogEntry(MethodBase methodBase, object[] argumentValues, LoggingLevel entryLevel) {
            ILog logger = LogManager.GetLogger(methodBase.DeclaringType);
            if (ShouldLog(logger, entryLevel, methodBase)) {
                var logMessage = new StringBuilder();
                logMessage.Append(string.Format("{0}(", methodBase.Name));

                ParameterInfo[] parameterInfos = methodBase.GetParameters();
                if (argumentValues != null && parameterInfos != null) {
                    for (int i = 0; i < argumentValues.Length; i++) {
                        if (i > 0) {
                            logMessage.Append(" ");
                        }
                        logMessage.Append(string.Format("{0}:[{1}]", parameterInfos[i].Name, argumentValues[i]));
                    }
                }
                logMessage.Append(")");
                logger.Log(entryLevel, logMessage.ToString());
            }
        }

        public void LogSuccess(MethodBase methodBase, object returnValue, LoggingLevel successLevel) {
            ILog logger = LogManager.GetLogger(methodBase.DeclaringType);
            if (ShouldLog(logger, successLevel, methodBase)) {
                logger.Log(successLevel,
                           string.Format("{0} Returns:[{1}]", methodBase.Name,
                                         returnValue != null ? returnValue.ToString() : ""));
            }
        }

        public void LogException(MethodBase methodBase, Exception err, LoggingLevel exceptionLevel) {
            ILog logger = LogManager.GetLogger(methodBase.DeclaringType);
            if (ShouldLog(logger, exceptionLevel, methodBase)) {
                exceptionLogger.LogException(err, false, methodBase.DeclaringType);
            }
        }

        #endregion

        private bool ShouldLog(ILog logger, LoggingLevel loggingLevel, MethodBase methodBase) {
            if (methodBase != null && methodBase.Name != null) {
                return logger.IsEnabledFor(loggingLevel);
            }

            return false;
        }
    }
}
{'fraction_non_alphanumeric': 0.09532924961715161, 'fraction_numerical': 0.0032542113323124045, 'mean_word_length': 1.994269340974212, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3101159', 'n_tokens_mistral': 1263, 'n_tokens_neox': 1205, 'n_words': 265}