summaryrefslogtreecommitdiff
path: root/product/Service/Infrastructure/Logging/LogFileTasks.cs
blob: 645a3e89e11391f5ffcb90278203b873140090b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
using System.IO;
using Gorilla.Commons.Infrastructure.Reflection;
using MoMoney.Service.Contracts.Infrastructure.Logging;

namespace MoMoney.Service.Infrastructure.Logging
{
    public class LogFileTasks : ILogFileTasks
    {
        public string get_the_contents_of_the_log_file()
        {
            using (
                var file_stream = new FileStream(get_the_path_to_the_log_file(), FileMode.Open, FileAccess.Read,
                                                 FileShare.ReadWrite))
            {
                using (var reader = new StreamReader(file_stream))
                {
                    return reader.ReadToEnd();
                }
            }
        }

        public string get_the_path_to_the_log_file()
        {
            return Path.Combine(this.startup_directory(), @"logs\log.txt");
        }
    }
}