public LogEngine(string filename, LogEngineMode mode, Encoding encoding) { switch (mode) { case LogEngineMode.CreateNew: if (System.IO.File.Exists(filename)) { throw new FileHelpersException("The file: " + filename + " already exists try using the LogEngineMode.Override or LogEngineMode.Append"); } mWriter = new System.IO.StreamWriter(filename, false, encoding); break; case LogEngineMode.Override: if (System.IO.File.Exists(filename)) { System.IO.File.Delete(filename); } mWriter = new System.IO.StreamWriter(filename, false, encoding); break; case LogEngineMode.Append: mWriter = new System.IO.StreamWriter(filename, true, encoding); break; } }
public LogEngine(string filename, LogEngineMode mode) : this(filename, mode, Encoding.Default) { }