Пример #1
0
 private void FlushLog()
 {
     lock (SyncRoot)
     {
         try
         {
             while (LogQueue.Count > 0)
             {
                 LogQueue.TryDequeue(out string logEntry);
                 byte[] output = new UTF8Encoding().GetBytes(logEntry + Environment.NewLine);
                 _outputStream.Write(output, 0, output.Length);
             }
         }
         catch (Exception e)
         {
             SentryLogger.Log(e);
         }
     }
 }
Пример #2
0
        /// <inheritdoc />
        public void Dispose()
        {
            lock (SyncRoot)
            {
                try
                {
                    FlushLog();

                    byte[] output = new UTF8Encoding().GetBytes(Environment.NewLine);
                    _outputStream.Write(output, 0, output.Length);

                    _outputStream.Flush();
                    _outputStream.Flush(true);
                    _outputStream.Dispose();
                    _outputStream.Close();
                    _outputStream = null;
                    _instance     = null;
                }
                catch (Exception e)
                {
                    SentryLogger.Log(e);
                }
            }
        }