Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ErrorLog.cs « UVtools.WPF - github.com/sn4k3/UVtools.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1dd6775d3da186eaafc087ec8d4973aac5b3274a (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
28
29
30
31
32
using System;
using System.Diagnostics;
using System.IO;
using UVtools.Core;

namespace UVtools.WPF;

public static class ErrorLog
{
    private const string Filename = "errors.log";

    public static string FullPath = Path.Combine(UserSettings.SettingsFolder, Filename);

    public static void AppendLine(string errorType, string text)
    {
        try
        {
            File.AppendAllText(FullPath,
                $"[v{About.VersionStr}] ({errorType}) @ {DateTime.Now}: {text}{Environment.NewLine}");
        }
        catch (Exception exception)
        {
            Console.WriteLine(exception);
            Debug.WriteLine(exception);
        }
    }

    public static StreamWriter GetStreamWriter()
    {
        return File.AppendText(FullPath);
    }
}