Пример #1
0
        private void LogData(object sender, List <Tuple <int, int, int> > Data)
        {
            try
            {
                lock (Locker)
                {
                    if ((DateTime.Now - RecordTime).Days > 0)
                    {
                        if (RecordWriter != null)
                        {
                            Dispose();
                        }

                        RecordWriter = CreateStreamWriter();
                    }

                    if (RecordWriter != null)
                    {
                        string message = GetMessagefromList(Data);

                        string inputMessage = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:fff;") + message;

                        RecordWriter.BaseStream.Seek(0, SeekOrigin.End);
                        RecordWriter.WriteLine(inputMessage);
                        RecordWriter.Flush();
                    }
                }
            }
            catch (Exception ex)
            {
                LogFiler.Log(Category.Error, MethodBase.GetCurrentMethod().DeclaringType.Name + "_" + MethodBase.GetCurrentMethod().Name + ": " + ex.Message);
            }
        }