<commit_before>﻿using System;
using System.Globalization;
using NLog;
using NLog.Config;
using NLog.Targets;

namespace Objectivity.Test.Automation.Common.Logger
{
    /// <summary>
    /// Class for test logger
    /// </summary>
    public class TestLogger
    {
        /// <summary>
        /// The logger
        /// </summary>
        private readonly NLog.Logger log = LogManager.GetLogger("TEST");

        /// <summary>
        /// The start test time
        /// </summary>
        private DateTime startTestTime;

        /// <summary>
        /// Initializes a new instance of the <see cref="TestLogger"/> class.
        /// </summary>
        /// <param name="testName">Name of the test.</param>
        public TestLogger(string testName)
        {
            TestName = testName;
            TestFolder = TestFolderPattern(testName);
            SetLogFileLocalization(TestFolder, testName);
        }

        /// <summary>
        /// Gets the test folder.
        /// </summary>
        /// <value>
        /// The test folder.
        /// </value>
        public string TestFolder { get; set; }

        /// <summary>
        /// Gets the name of the test.
        /// </summary>
        /// <value>
        /// The name of the test.
        /// </value>
        private string TestName { get; set; }

        /// <summary>
        /// Tests the folder pattern.
        /// </summary>
        /// <param name="testName">Name of the test.</param>
        /// <returns>Folder name</returns>
        private string TestFolderPattern(string testName)
        {
            var testFolder = AppDomain.CurrentDomain.BaseDirectory + BaseConfiguration.TestFolder;
            log.Info("TESTFOLDER:  " + testFolder);
            if (string.IsNullOrEmpty(testFolder))
            {
                return string.Empty;
            }

            return string.Format(CultureInfo.CurrentCulture, "{0}\\{1}_{2}", testFolder, DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss", CultureInfo.CurrentCulture), testName);
        }

        /// <summary>
        /// Sets the log file localization.
        /// </summary>
        private void SetLogFileLocalization(string folder, string logName)
        {
            var pattern = string.IsNullOrEmpty(folder) ? "{1}.log" : "{0}\\{1}.log";
            FileTarget target = LogManager.Configuration.FindTargetByName("logfile") as FileTarget;<commit_msg>change logging to console<commit_after>﻿using System;
using System.Globalization;
using NLog;
using NLog.Config;
using NLog.Targets;

namespace Objectivity.Test.Automation.Common.Logger
{
    using System.IO;

    /// <summary>
    /// Class for test logger
    /// </summary>
    public class TestLogger
    {
        /// <summary>
        /// The logger
        /// </summary>
        private readonly NLog.Logger log = LogManager.GetLogger("TEST");

        /// <summary>
        /// The start test time
        /// </summary>
        private DateTime startTestTime;

        /// <summary>
        /// Initializes a new instance of the <see cref="TestLogger"/> class.
        /// </summary>
        /// <param name="testName">Name of the test.</param>
        public TestLogger(string testName)
        {
            TestName = testName;
            TestFolder = TestFolderPattern(testName);
            SetLogFileLocalization(TestFolder, testName);
        }

        /// <summary>
        /// Gets the test folder.
        /// </summary>
        /// <value>
        /// The test folder.
        /// </value>
        public string TestFolder { get; set; }

        /// <summary>
        /// Gets the name of the test.
        /// </summary>
        /// <value>
        /// The name of the test.
        /// </value>
        private string TestName { get; set; }

        /// <summary>
        /// Tests the folder pattern.
        /// </summary>
        /// <param name="testName">Name of the test.</param>
        /// <returns>Folder name</returns>
        private string TestFolderPattern(string testName)
        {
            var testFolder = AppDomain.CurrentDomain.BaseDirectory + BaseConfiguration.TestFolder;
            Console.WriteLine("TESTFOLDER:  " + testFolder);
            Console.WriteLine("CodeBase: " + GetType().Assembly.CodeBase);
            Console.WriteLine("Working Directory: " + Directory.GetCurrentDirectory());
            if (string.IsNullOrEmpty(testFolder))
            {
                return string.Empty;
            }

            return string.Format(CultureInfo.CurrentCulture, "{0}\\{1}_{2}", testFolder, DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss", CultureInfo.CurrentCulture), testName);
        }

        /// <summary>
        /// Sets the log file localization.
        /// </summary>
        private void SetLogFileLocalization(string folder, string logName)
        {
            var pattern = string.IsNullOrEmpty(folder) ? "{1}.log" : "{0}\\{1}.log";
            FileTarget target = LogManager.Configuration.FindTargetByName("logfile") as FileTarget;
{'fraction_non_alphanumeric': 0.13494602159136346, 'fraction_numerical': 0.0023990403838464614, 'mean_word_length': 1.761037527593819, 'pattern_counts': {'":': 0, '<': 57, '<?xml version=': 0, '>': 57, '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': '1213357', 'n_tokens_mistral': 1313, 'n_tokens_neox': 1293, 'n_words': 323}