public void Error(string className, string methodName, object o) { model = new RecordModel(DateTime.Now.Date, GetHeader(className, methodName, Level.Error) + "********************************" + o.ToString() + "********************************"); queue.Put(model); }
public void Put(RecordModel record) { lock (threadLock) { if (queue.Count > 1000) { queue.Dequeue(); } queue.Enqueue(record); } }
public RecordModel Get() { lock (threadLock) { if (queue.Count > 0) { record = (RecordModel)queue.Dequeue(); return record; } return null; } }
public void Warn(string className, string methodName, object o) { model = new RecordModel(DateTime.Now.Date, GetHeader(className,methodName, Level.Warn) + o.ToString()); queue.Put(model); }
public void Warn(string className, string methodName, object o) { model = new RecordModel(DateTime.Now.Date, GetHeader(className, methodName, Level.Warn) + o.ToString()); queue.Put(model); }
private void CompareRecordDate(RecordModel model) { if (model.DTime.Date != fileCreateDate.Date) { CreateFile(); } }
private void Write(RecordModel model) { CompareRecordDate(model); if (sw != null) { sw.Close(); } if (fs != null) { fs.Close(); } //Console.WriteLine("Using Writer"); using (fs = new FileStream(filePath, FileMode.Append, FileAccess.Write, FileShare.ReadWrite)) { using (sw = new StreamWriter(fs)) { sw.WriteLine(model.Record); } } }