/// <summary> /// Will remove all messages from the log. /// </summary> /// <remarks> /// This will permanently delete all messages; this action <i>cannot</i> be undone. /// <para>This only clears the log, it will <i>not</i> delete it.</para> /// </remarks> /// <returns>The number of log entries removed.</returns> public override int Clear() { if (Exists) { var count = InternalEventLog.Entries.Count; InternalEventLog.Clear(); return(count); } return(0); }
/// <summary> /// Writes an <see cref="ILogEntry"/> to the log. /// </summary> /// <param name="logEntry">The entry to write.</param> public override void Write(ILogEntry logEntry) { if (logEntry == null) { throw new ArgumentNullException(nameof(logEntry)); } Create(); InternalEventLog.WriteEntry(CombineSourceIdAndMessage(logEntry), ConvertFromLogEntryType(logEntry.EntryType), logEntry.EventId, (short)logEntry.Category); ++_LogStats.LogWrites; }