示例#1
0
        public void WriteAsync(ILogEntry entry, string category, Action <Task> continueWith)
        {
            try
            {
                if (entry == null)
                {
                    throw new ArgumentNullException("entry");
                }

                if (continueWith == null)
                {
                    throw new ArgumentNullException("continueWith");
                }

                if (!CheckSectionStatus(entry))
                {
                    continueWith(null);
                    return;
                }

                var clone = entry.CopyTo();

                TaskFactory.StartNew(() => this.Write(clone, category))
                .ContinueWith(continueWith);
            }
            catch (LogException)
            {
                throw;
            }
            catch (Exception ex)
            {
                FailSafeLogFactory.Log(ex);
            }
        }