using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace NX_Installation { class Logfile { private string FileName { set; get; } /// /// Name of the logfile and path where the logfile will be located /// /// public Logfile(string filename) { FileName = filename; } /// /// Writes an info massage into the logfile /// /// This message will be write into the logfile public void Info(string message) { Logtext("INFO ", message); } /// /// Writes a warn massage into the logfile /// /// This message will be write into the logfile public void Warn(string message) { Logtext("WARN ", message); } /// /// Writes an error massage into the logfile /// /// This message will be write into the logfile public void Error(string message) { Logtext("ERROR", message); } /// /// Writes a fatal error massage into the logfile /// /// This message will be write into the logfile public void Fatal(string message) { Logtext("FATAL", message); } private string Date() { return DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); } private void Logtext(string status, string message) { StreamWriter myFile = new StreamWriter(FileName, true); myFile.Write(status + " - " + Date() + " - " + message + "\n"); myFile.Close(); } } }