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

namespace Service_demo
{
    public partial class Service1 : ServiceBase
    {
        private readonly StreamWriter _writer;

        public Service1()
        {
            InitializeComponent();
            _writer = File.CreateText("service log.txt");
        }

        protected override void OnStart(string[] args)
        {
            WriteLine("Started at: " + DateTime.Now);
        }

        protected override void OnStop()
        {
            WriteLine("Stopped at: " + DateTime.Now);
        }

        async void WriteLine(string text)
        {
            await _writer.WriteLineAsync(text);
        }

        // To test the service as a console app
        internal void TestStartupAndStop(string[] args)
        {
            this.OnStart(args);
            Console.ReadLine();
            this.OnStop();
        }
    }
}<commit_msg>Close the log.<commit_after>﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Threading.Tasks;

namespace Service_demo
{
    public partial class Service1 : ServiceBase
    {
        private StreamWriter _writer;

        public Service1()
        {
            InitializeComponent();
        }

        protected override void OnStart(string[] args)
        {
            _writer = File.CreateText("service log.txt");
            WriteLine("Started at: " + DateTime.Now);
        }

        protected override void OnStop()
        {
            WriteLine("Stopped at: " + DateTime.Now);
            _writer.Close();
        }

        //async void WriteLine(string text)
        //{
        //    await _writer.WriteLineAsync(text);
        //}

        void WriteLine(string text)
        {
            _writer.WriteLine(text);
        }

        // To test the service as a console app
        internal void TestStartupAndStop(string[] args)
        {
            this.OnStart(args);
            Console.ReadLine();
            this.OnStop();
        }
    }
}
{'fraction_non_alphanumeric': 0.09424307036247334, 'fraction_numerical': 0.0017057569296375266, 'mean_word_length': 1.943538268506901, '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': '7426389', 'n_tokens_mistral': 611, 'n_tokens_neox': 606, 'n_words': 152}