using System; using System.IO; namespace DumpLib.Helpers { public static class UtilsHelper { private static string _loggerPath = (Directory.GetCurrentDirectory() + "\\DUMPDATA\\Log.txt").Replace("\\\\", "\\"); /// /// Log message to something /// /// object private static void LogMessage(object message, string messageType) { StreamWriter writer = null; try { writer = new StreamWriter(_loggerPath, true); writer.WriteLine($"[{messageType}] - {DateTime.Now:yyyy-MM-dd HH:mm:ss} - {message}"); } catch (Exception e) { Console.WriteLine(e); throw; } finally { if (writer != null) { writer.Close(); writer.Dispose(); } } } /// /// Log message to something /// /// object public static void LogError(object message) { LogMessage(message, "Error"); } /// /// Log message to something /// /// object public static void LogInfo(object message) { LogMessage(message, "Info"); } /// /// Log message to something /// /// object public static void LogDebug(object message) { LogMessage(message, "Debug"); } } }