示例#1
0
        /// <summary>
        /// Logs the message for Debug level
        /// </summary>
        /// <param name="message">message to be logged</param>
        /// <param name="identifier">identifier of the message to be logged</param>
        public Guid Debug(string message, string identifier = "")
        {
            Guid uniqueEventIdentifier;
            var  info = _logEventInfoFactory.Create(LogLevel.Debug, message, out uniqueEventIdentifier, identifier);

            GetLogger().Log(info);
            return(uniqueEventIdentifier);
        }
示例#2
0
        /// <summary>
        /// Starts the specified log section.
        /// </summary>
        /// <param name="section">The log section.</param>
        /// <example>This sample shows how to log the data insertion to some control in the scope of the control.
        /// <code>
        /// string value = "new_value";
        /// Log.Start(new DataAdditionLogSection(this, value));
        /// // TODO: Add a value to the control.
        /// Log.EndSection();
        /// </code>
        /// </example>
        public void Start(LogSection section)
        {
            section.CheckNotNull(nameof(section));

            LogEventInfo eventInfo = _logEventInfoFactory.Create(section.Level, section.Message);

            eventInfo.SectionStart = section;

            section.StartedAt = eventInfo.Timestamp;
            section.Stopwatch.Start();

            Log(eventInfo);

            _sectionEndStack.Push(section);
        }