Exemple #1
0
        public async Task <string> GetLog()
        {
            try
            {
                await LogQueueLock.WaitAsync();

                if (false == LogQueue.Any())
                {
                    return("");
                }

                var lastWriteTimeUtc = LogQueue.Last().TimeUtc;
                if (lastWriteTimeUtc != LastWriteTimeUtc)
                {
                    Log = string.Join(Environment.NewLine, LogQueue.Select(li => li.Message).Reverse().ToList());
                    LastWriteTimeUtc = lastWriteTimeUtc;
                }

                return(Log);
            }
            finally
            {
                LogQueueLock.Release();
            }
        }