示例#1
0
        /// <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);
            }
        }
示例#2
0
        /// <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);
            }
        }