static void Logger_Logged(LoggerArgs args) { if (queue.Count < queueLimit || args.Priority == LogPriority.Debug || args.Priority == LogPriority.Error) { queue.Enqueue(args.LogString); if (queue.Count < queueLimit - 10) { queueLimitExceeded = false; } } if (queue.Count == queueLimit && !queueLimitExceeded) { queueLimitExceeded = true; Logger.Debug("Queue is full"); } #if (NETMF || OnBoardMonitorEmulator) && DebugOnRealDeviceOverFTDI if (System.Diagnostics.Debugger.IsAttached) { Debug.Print(args.LogString); Logger.FreeMemory(); } #endif }
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); }
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); } }
//[Conditional("DEBUG")] public static void WriteLine(string text) { MFDebug.Print(text); }