Beispiel #1
0
        private void TryWriteToTable(string channel, string source, OutputLevel level, string message)
        {
            try
            {
                if (!_log.TryGetValue(channel, out var queue))
                {
                    queue         = new ConcurrentDictionary <LogEntry, LogEntry>();
                    _log[channel] = queue;
                }

                var newItem = new LogEntry()
                {
                    Level     = level,
                    Source    = string.IsNullOrEmpty(source) ? UnknownSource : source,
                    Message   = message,
                    TimeStamp = DateTime.Now,
                };

                queue[newItem] = newItem;
            }
            catch (Exception e)
            {
                Debug.WriteLine("caught unexpected exception " + e);
            }
        }