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

namespace mash.Logging.Target
{
	public class File : IBase
	{
		protected StreamWriter _fileStream;
		public string FileName { get; set; }

		public File()
		{
		}

		public File(string filename, bool tryToCreateIfNotExists = true)
		{
			var fi = new FileInfo(filename);
			if (tryToCreateIfNotExists)
			{
				Directory.CreateDirectory(fi.Directory.FullName);
			}
			_fileStream = fi.CreateText();
		}

		public void logMessage(string message, MessageLevel level = MessageLevel.Normal)
		{<commit_msg>Logging.Target.File's default constructor now uses a default log file name which is accessible via the Logging.Target.File.DefaultLogName property.<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;
using System.IO;
using System.Reflection;

namespace mash.Logging.Target
{
	public class File : IBase
	{
		public static string DefaultLogName { get; protected set; }

		static File()
		{
			string programName = Assembly.GetExecutingAssembly().FullName;
			DefaultLogName = string.Format("{0}.log", programName);
		}

		protected StreamWriter _fileStream;
		public string FileName { get; set; }

		public File() :
			this(DefaultLogName, false)
		{
		}

		public File(string filename, bool tryToCreateIfNotExists = true)
		{
			var fi = new FileInfo(filename);
			if (tryToCreateIfNotExists)
			{
				Directory.CreateDirectory(fi.Directory.FullName);
			}
			_fileStream = fi.CreateText();
		}

		public void logMessage(string message, MessageLevel level = MessageLevel.Normal)
		{
{'fraction_non_alphanumeric': 0.09405099150141644, 'fraction_numerical': 0.0005665722379603399, 'mean_word_length': 4.400611620795107, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '504319', 'n_tokens_mistral': 586, 'n_tokens_neox': 524, 'n_words': 139}