<commit_before>﻿using Monkeyspeak.Utils;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace Monkeyspeak.Logging
{
    public class FileLogOutput : ILogOutput, IEquatable<FileLogOutput>
    {
        private readonly Level level;
        private readonly string filePath;

        public FileLogOutput(Level level = Level.Error)
        {
            if (Assembly.GetEntryAssembly() != null)
            {
                filePath = Path.Combine(Assembly.GetEntryAssembly().Location, $"{Assembly.GetCallingAssembly()?.GetName().Name}.{level}.log");
                if (!IOPermissions.HasAccess(filePath))
                    filePath = Path.Combine(Path.GetFullPath(Environment.GetFolderPath(Environment.SpecialFolder.Personal)), Path.GetFileName(filePath));
            }
            else
                filePath = Path.Combine(Path.GetFullPath(Environment.GetFolderPath(Environment.SpecialFolder.Personal)), Path.GetFileName(filePath));

            if (File.Exists(filePath)) File.WriteAllText(filePath, ""); // make sure it is a clean file
            this.level = level;
        }

        public override bool Equals(object obj)
        {
            return Equals(obj as FileLogOutput);
        }

        public bool Equals(FileLogOutput other)
        {
            return other != null &&<commit_msg>Fixed FileLogOutput.<commit_after>﻿using Monkeyspeak.Utils;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace Monkeyspeak.Logging
{
    public class FileLogOutput : ILogOutput, IEquatable<FileLogOutput>
    {
        private readonly Level level;
        private readonly string filePath;

        public FileLogOutput(Level level = Level.Error)
        {
            if (Assembly.GetEntryAssembly() != null)
            {
                filePath = Path.Combine(Assembly.GetEntryAssembly().Location, $"{Assembly.GetEntryAssembly().GetName().Name}.{level}.log");
                if (!IOPermissions.HasAccess(filePath))
                    filePath = Path.Combine(Path.GetFullPath(Environment.GetFolderPath(Environment.SpecialFolder.Personal)), $"{Assembly.GetEntryAssembly()?.GetName().Name}.{level}.log");
            }
            else
                filePath = Path.Combine(Path.GetFullPath(Environment.GetFolderPath(Environment.SpecialFolder.Personal)), $"{Assembly.GetExecutingAssembly()?.GetName().Name}.{level}.log");

            if (File.Exists(filePath)) File.WriteAllText(filePath, ""); // make sure it is a clean file
            this.level = level;
        }

        public override bool Equals(object obj)
        {
            return Equals(obj as FileLogOutput);
        }

        public bool Equals(FileLogOutput other)
        {
            return other != null &&
{'fraction_non_alphanumeric': 0.10656836461126006, 'fraction_numerical': 0.0, 'mean_word_length': 2.7265917602996255, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2474374', 'n_tokens_mistral': 797, 'n_tokens_neox': 780, 'n_words': 161}