public void Close() { Flush(); t.Stop(); t.Elapsed -= new ElapsedEventHandler(t_Elapsed); t.Close(); t.Dispose(); q.Clear(); writer = null; }
public TextLog(string fileName, string subDir = "", string who = "", bool isWriteToConsole = true, int writeInvervalInSeconds = 1) { this.writer = new LogImp2Writer(subDir, fileName); this.who = who; this.isWriteToConsole = isWriteToConsole; q = new Queue <LogEntry>(); syncObj = new object(); t = new Timer(writeInvervalInSeconds * 1000); t.Elapsed += new ElapsedEventHandler(t_Elapsed); t.Start(); }