当前位置: 首页>>代码示例>>C#>>正文


C# ObservableEventListener.LogToElasticsearch方法代码示例

本文整理汇总了C#中ObservableEventListener.LogToElasticsearch方法的典型用法代码示例。如果您正苦于以下问题:C# ObservableEventListener.LogToElasticsearch方法的具体用法?C# ObservableEventListener.LogToElasticsearch怎么用?C# ObservableEventListener.LogToElasticsearch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ObservableEventListener的用法示例。


在下文中一共展示了ObservableEventListener.LogToElasticsearch方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateListener

 /// <summary>
 /// Creates an event listener that logs using a <see cref="ElasticsearchSink" />.
 /// </summary>
 /// <param name="instanceName">The name of the instance originating the entries.</param>
 /// <param name="connectionString">The endpoint address for the Elasticsearch Service.</param>
 /// <param name="index">Index name prefix formatted as index-{0:yyyy.MM.DD}</param>
 /// <param name="type">The Elasticsearch entry type</param>
 /// <param name="flattenPayload">Flatten the payload collection when serializing event entries</param>
 /// <param name="bufferingInterval">The buffering interval between each batch publishing.</param>
 /// <param name="listenerDisposeTimeout">Defines a timeout interval for the flush operation when the listener is disposed.</param>
 /// <param name="maxBufferSize">The maximum number of entries that can be buffered while it's sending to Elasticsearch 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. Calling <see cref="IDisposable.Dispose" /> on
 /// the <see cref="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="ElasticsearchSink" /> to log events.
 /// </returns>
 public static EventListener CreateListener(string instanceName, string connectionString, string index, string type, bool flattenPayload = true,
     TimeSpan? bufferingInterval = null, TimeSpan? listenerDisposeTimeout = null, int maxBufferSize = Buffering.DefaultMaxBufferSize)
 {
     var listener = new ObservableEventListener();
     listener.LogToElasticsearch(instanceName, connectionString, index, type, flattenPayload, bufferingInterval,
         listenerDisposeTimeout, maxBufferSize);
     return listener;
 }
开发者ID:MedAnd,项目名称:slab-sinks,代码行数:25,代码来源:ElasticsearchLog.cs

示例2: Application_Start

        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);


            var listener = new ObservableEventListener();
            listener.EnableEvents(TestEvents.Log, EventLevel.LogAlways, Keywords.All);

            listener.LogToConsole();
            listener.LogToElasticsearch("SLABEL", "http://localhost:9200", "myindex", "mytype", bufferingCount: 1);

            TestEvents.Log.Critical("Hello world In-Process Critical");
            TestEvents.Log.Error("Hello world In-Process Error");
            TestEvents.Log.Informational("Hello world In-Process Informational");
        }
开发者ID:ateregulov,项目名称:beeline-promo-everything-is-new,代码行数:18,代码来源:Global.asax.cs


注:本文中的ObservableEventListener.LogToElasticsearch方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。