/// <summary> /// Ends the latest log section. /// </summary> public void EndSection() { if (sectionEndStack.Any()) { LogSection section = sectionEndStack.Pop(); TimeSpan duration = section.GetDuration(); LogEventInfo eventInfo = new LogEventInfo { Level = section.Level, Message = $"Finished: {section.Message} ({duration.ToIntervalString()})", SectionEnd = section }; Log(eventInfo, true); } }
/// <summary> /// Ends the latest log section. /// </summary> public void EndSection() { if (sectionEndStack.Any()) { LogSection section = sectionEndStack.Pop(); TimeSpan duration = section.GetDuration(); LogEventInfo eventInfo = new LogEventInfo { Level = section.Level, Message = $"Finished: {section.Message} ({Math.Floor(duration.TotalSeconds)}.{duration:fff}s)", SectionEnd = section }; Log(eventInfo, true); } }