Exemplo n.º 1
0
        public static void Dispose(int waitTimeout = 2000)
        {
            Logger.Logged -= Logger_Logged;
            bool waitResult = queue.WaitTillQueueBeEmpty(waitTimeout);

            writer.Flush();
            if (FlushCallback != null)
            {
                FlushCallback();
            }
            Debug.GC(true);
            unflushed = 0;

            writer.Dispose();

            Thread.Sleep(1000);
        }
Exemplo n.º 2
0
        static void ProcessItem(object o)
        {
            try
            {
                writer.WriteLine((string)o);
                o = null;
                if (++unflushed == flushLines)
                {
                    writer.Flush();
                    Debug.GC(true);
                    unflushed = 0;
                }

                Thread.Sleep(0);
            }
            catch (Exception ex)
            {
                // don't use logger to prevent recursion
                Logger.ErrorWithoutLogging("Can't write log to sd: " + ex.Message);
            }
        }