/// <summary> /// Writes the specified entry to the log store. /// </summary> /// <param name="exception"> /// The exception to write to the log store. /// </param> /// <exception cref="ArgumentNullException"> /// <paramref name="exception"/> is null. /// </exception> public void WriteEntry(Exception exception) { if (AutomaticDisable) { return; } if (exception == null) { throw new ArgumentNullException("exception"); } var entry = new LogEntry(LogCategory.Error, exception.ToString()); WriteEntry(entry); }
/// <summary> /// Writes the specified entry to the log store with category and format arguments. /// </summary> /// <param name="category"> /// The category of the log entry. /// </param> /// <param name="entry"> /// The entry to write. /// </param> /// <param name="args"> /// The arguments to format the entry. /// </param> /// <exception cref="ArgumentNullException"> /// <paramref name="entry"/> is null. /// </exception> public void WriteEntry(LogCategory category, string entry, params object[] args) { if (AutomaticDisable) { return; } if (string.IsNullOrEmpty(entry)) { throw new ArgumentNullException("entry"); } entry = string.Format(CultureInfo.CurrentCulture, entry, args); var logEntry = new LogEntry(category, entry); WriteEntry(logEntry); }
/// <summary> /// Writes the specified entry to the log store. /// </summary> /// <param name="entry"> /// The entry to write to the log store. /// </param> /// <exception cref="ArgumentNullException"> /// <paramref name="entry"/> is null. /// </exception> public void WriteEntry(LogEntry entry) { if (AutomaticDisable) { return; } if (entry == null) { throw new ArgumentNullException("entry"); } byte[] bytes = entry.ToSerializedByteArray(); _sequence.Append(new ArraySegment<byte>(bytes), SequenceNumber.Invalid, SequenceNumber.Invalid, RecordAppendOptions.ForceFlush); }
/// <summary> /// Writes the specified entry to the log store with format arguments. /// </summary> /// <param name="category"> /// The category of the log entry. /// </param> /// <param name="entry"> /// The entry to write. /// </param> /// <exception cref="ArgumentNullException"> /// <paramref name="entry"/> is null. /// </exception> public void WriteEntry(LogCategory category, string entry) { if (AutomaticDisable) { return; } if (string.IsNullOrEmpty(entry)) { throw new ArgumentNullException("entry"); } var logEntry = new LogEntry(category, entry); WriteEntry(logEntry); }