You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.2 KiB
40 lines
1.2 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows;
|
|
|
|
namespace BiskLog_Point_Of_Sale.Classes
|
|
{
|
|
public class ErrorLogging
|
|
{
|
|
public static void WriteToFile(string Message)
|
|
{
|
|
string path = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + @"\BISKILOG POS\\Logs";
|
|
if (!Directory.Exists(path))
|
|
{
|
|
Directory.CreateDirectory(path);
|
|
}
|
|
string filepath = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + @"\BISKILOG POS\\Logs\\ServiceLog_"
|
|
+ DateTime.Now.Date.ToShortDateString().Replace('/', '_') + ".txt";
|
|
if (!File.Exists(filepath))
|
|
{
|
|
|
|
using (StreamWriter sw = File.CreateText(filepath))
|
|
{
|
|
sw.WriteLine(Message);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
|
|
using (StreamWriter sw = File.AppendText(filepath))
|
|
{
|
|
sw.WriteLine(Message);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|