public override void LogMessage(LogRow row) { lock (queue) { AsyncLogMessage(row); } /*lock (queue) { queue.Enqueue(() => AsyncLogMessage(row)); }*/ hasNewItems.Set(); }
protected override void AsyncLogMessage(LogRow row) { UpdateStream(); writer.WriteLine(row.ToString()); }
public override void LogMessage(LogRow row) { foreach (var logger in Loggers) { if (logger.Enabled) logger.LogMessage(row); } }
protected abstract void AsyncLogMessage(LogRow row);
public abstract void LogMessage(LogRow row);
void LogMessage(LogSeverity severity, string message, string category) { if (!Enabled) return; string threadName = Thread.CurrentThread.Name; int threadId = Thread.CurrentThread.ManagedThreadId; DateTime now = DateTime.Now; LogRow row = new LogRow() { Severity = severity, Message = message, Category = category, ThreadId = threadId, ThreadName = threadName, Time = now }; LogMessage(row); }