123456789101112131415161718192021222324252627282930313233343536373839404142 |
- using System.IO;
- using System.Text.RegularExpressions;
- namespace GCHR.Control
- {
- public class Logger
- {
- public static string ConfigDatei = "config\\gchr.xml";
- public static string LogDatei
- {
- get { return "logs\\" + Regex.Match(ConfigDatei, @"\w*\.xml$") + ".log"; }
- }
- public static string ExportLog = LogDatei;
- public static void Info(string message)
- {
- lock(LogDatei)
- {
- Log(message, LogDatei);
- }
- }
- public static void Progress(string message)
- {
- lock(ExportLog)
- {
- Log(message, ExportLog);
- }
- }
- private static void Log(string message, string datei)
- {
- using (var sw = new StreamWriter(datei, true))
- {
- sw.WriteLine(message);
- }
- }
- public static bool DateiExistiert { get { return File.Exists(LogDatei); }
- }
- }
- }
|