public void OnNext(EventEntry value) { var sw = new StringWriter(); formatter.WriteEvent(value, sw); socket.Send(Encoding.UTF8.GetBytes(sw.ToString())); }
public void OnNext(EventEntry value) { var sw = new StringWriter(); formatter.WriteEvent(value, sw); this.writer.Enqueue(sw.ToString()); }
/// <summary> /// Formats the event as a string. /// </summary> /// <param name="entry">The entry to format.</param> /// <param name="formatter">The formatter to use.</param> /// <returns>A formatted entry.</returns> public static string WriteEvent(this IEventTextFormatter formatter, EventEntry entry) { Guard.ArgumentNotNull(formatter, "formatter"); using (var writer = new StringWriter(CultureInfo.CurrentCulture)) { formatter.WriteEvent(entry, writer); return(writer.ToString()); } }
/// <summary> /// Formats the event as a string. /// </summary> /// <param name="snapshot">The partition snapshot to format.</param> /// <param name="formatter">The formatter to use.</param> /// <returns>A formatted snapshot.</returns> public static string WriteEvent(this IEventTextFormatter formatter, PartitionSnapshot snapshot) { Guard.ArgumentNotNull(formatter, "formatter"); using (var writer = new StringWriter(CultureInfo.CurrentCulture)) { formatter.WriteEvent(snapshot, writer); return(writer.ToString()); } }
public void OnNext(EventEntry entry) { if (entry == null) { return; } using (var writer = new StringWriter()) { _formatter.WriteEvent(entry, writer); _log.Add(writer.ToString()); } }
/// <summary> /// All events are going through OnNext callback. /// </summary> /// <param name="value">An event.</param> public void OnNext(EventEntry value) { using (var sw = new StringWriter()) { formatter.WriteEvent(value, sw); sender.Send( id: value.EventId.ToString(), severity: value.Schema.Level.ToString(), message: sw.ToString() ); } }
public void OnNext(EventEntry value) { if (value == null) { return; } using (var writer = new StringWriter()) { formatter.WriteEvent(value, writer); events.Enqueue(new DbEventEntry(value, writer.ToString())); } }
/// <summary> /// Formats an <see cref="EventEntry"/> as a string using an <see cref="IEventTextFormatter"/>. /// </summary> /// <param name="entry">The entry to format.</param> /// <param name="formatter">The formatter to use.</param> /// <returns>A formatted entry, or <see langword="null"/> if an exception is thrown by the <paramref name="formatter"/>.</returns> public static string TryFormatAsString(this EventEntry entry, IEventTextFormatter formatter) { try { return(formatter.WriteEvent(entry)); } catch (Exception e) { SemanticLoggingEventSource.Log.FormatEntryAsStringFailed(e.ToString()); } return(null); }
/// <summary> /// Formats an <see cref="EventEntry"/> as a string using an <see cref="IEventTextFormatter"/>. /// </summary> /// <param name="entry">The entry to format.</param> /// <param name="formatter">The formatter to use.</param> /// <returns>A formatted entry, or <see langword="null"/> if an exception is thrown by the <paramref name="formatter"/>.</returns> public static string TryFormatAsString(this EventEntry entry, IEventTextFormatter formatter) { try { return formatter.WriteEvent(entry); } catch (Exception e) { SemanticLoggingEventSource.Log.FormatEntryAsStringFailed(e.ToString()); } return null; }
/// <summary> /// Formats an <see cref="PartitionSnapshot" /> as a string using an <see cref="IEventTextFormatter" />. /// </summary> /// <param name="snapshot">The snapshot to format.</param> /// <param name="formatter">The formatter to use.</param> /// <returns>A formatted snapshot, or <see langword="null" /> if an exception is thrown by the <paramref name="formatter" />.</returns> public static string TryFormatAsString(this PartitionSnapshot snapshot, IEventTextFormatter formatter) { try { return(formatter.WriteEvent(snapshot)); } catch (Exception e) { //SemanticLoggingEventSource.Log.FormatEntryAsStringFailed(e.ToString()); } return(null); }
/// <summary> /// Formats an <see cref="PartitionSnapshot" /> as a string using an <see cref="IEventTextFormatter" />. /// </summary> /// <param name="snapshot">The snapshot to format.</param> /// <param name="formatter">The formatter to use.</param> /// <returns>A formatted snapshot, or <see langword="null" /> if an exception is thrown by the <paramref name="formatter" />.</returns> public static string TryFormatAsString(this PartitionSnapshot snapshot, IEventTextFormatter formatter) { try { return formatter.WriteEvent(snapshot); } catch (Exception e) { //SemanticLoggingEventSource.Log.FormatEntryAsStringFailed(e.ToString()); } return null; }
public void OnNext(EventEntry entry) { if (entry == null) { return; } using (var writer = new StringWriter()) { _formatter.WriteEvent(entry, writer); if (_log.Async) { SendAsync(writer.ToString()); } else { Send(writer.ToString()); } } }
public void OnNext(EventEntry value) { EventsWritten.Add(formatter.WriteEvent(value)); }