本文整理汇总了C#中ObservableEventListener.LogToSeq方法的典型用法代码示例。如果您正苦于以下问题:C# ObservableEventListener.LogToSeq方法的具体用法?C# ObservableEventListener.LogToSeq怎么用?C# ObservableEventListener.LogToSeq使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObservableEventListener
的用法示例。
在下文中一共展示了ObservableEventListener.LogToSeq方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateListener
/// <summary>
/// Creates an event listener that logs using a <see cref="SeqSink" />.
/// </summary>
/// <param name="serverUrl">The base URL of the Seq server that log events will be written to.</param>
/// <param name="apiKey">A Seq <i>API key</i> that authenticates the client to the Seq server.</param>
/// <param name="bufferingInterval">The buffering interval between each batch publishing. Default value is <see cref="Buffering.DefaultBufferingInterval" />.</param>
/// <param name="listenerDisposeTimeout">Time limit for flushing the entries after an <see cref="SeqSink.OnCompleted" /> call is received and before disposing the sink.</param>
/// <param name="bufferingCount">Number of entries that will trigger batch publishing. Default is <see cref="Buffering.DefaultBufferingCount" /></param>
/// <param name="maxBufferSize">The maximum number of entries that can be buffered before the sink starts dropping entries.
/// This means that if the timeout period elapses, some event entries will be dropped and not sent to the store. Normally, calling <see cref="IDisposable.Dispose" /> on
/// the <see cref="System.Diagnostics.Tracing.EventListener" /> will block until all the entries are flushed or the interval elapses.
/// If <see langword="null" /> is specified, then the call will block indefinitely until the flush operation finishes.</param>
/// <returns>
/// An event listener that uses <see cref="SeqSink" /> to log events.
/// </returns>
public static EventListener CreateListener(
string serverUrl,
string apiKey = null,
TimeSpan? bufferingInterval = null,
TimeSpan? listenerDisposeTimeout = null,
int bufferingCount = Buffering.DefaultBufferingCount,
int maxBufferSize = Buffering.DefaultMaxBufferSize)
{
var listener = new ObservableEventListener();
listener.LogToSeq(serverUrl, apiKey, bufferingInterval, listenerDisposeTimeout, bufferingCount, maxBufferSize);
return listener;
}
示例2: Main
static void Main()
{
using (var listener = new ObservableEventListener())
{
listener.EnableEvents(SampleEventSource.Log, EventLevel.LogAlways, SampleEventSource.Keywords.SampleApp);
listener.LogToConsole();
listener.LogToSeq("http://my-seq");
SampleEventSource.Log.Greeting(Environment.UserName);
}
Console.WriteLine("Done");
Console.ReadKey(true);
}