• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# TraceEvent类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中TraceEvent的典型用法代码示例。如果您正苦于以下问题:C# TraceEvent类的具体用法?C# TraceEvent怎么用?C# TraceEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TraceEvent类属于命名空间,在下文中一共展示了TraceEvent类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: GetKey

 public String GetKey(TraceEvent traceEvent)
 {
     // Original code combined the Provider GUID with the machine name
       // but you cannot mix events with different partition keys in the same
       // batch.
       return Environment.MachineName;
 }
开发者ID:naveensrinivasan,项目名称:iis-etw-tracing,代码行数:7,代码来源:BasicPartitionKeyGenerator.cs


示例2: Send

 public void Send(TraceEvent eventData)
 {
     lock (this.eventList)
     {
         this.EventList.Add(eventData);
     }
 }
开发者ID:ZeoAlliance,项目名称:ApplicationInsights-dotnet,代码行数:7,代码来源:DiagnosticsEventCollectingMock.cs


示例3: Format

 public string Format(TraceEvent traceEvent)
 {
     //string ret = format;
     return format.
         Replace("{%ContextHolderId}", traceEvent.ContextIdentifier.ContextHolderId.ToString()).
         Replace("{%ExternalId}", traceEvent.ContextIdentifier.ExternalId.ToString()).
         Replace("{%ExternalReference}", traceEvent.ContextIdentifier.ExternalReference.ToString()).
         Replace("{%ExternalParentId}", traceEvent.ContextIdentifier.ExternalParentId.ToString()).
         Replace("{%InternalId}", traceEvent.ContextIdentifier.InternalId.ToString()).
         Replace("{%InternalParentId}", traceEvent.ContextIdentifier.InternalParentId.ToString()).
         Replace("{%ContextGuid}", traceEvent.ContextIdentifier.ContextGuid.ToString()).
         Replace("{%HostName}", traceEvent.Location.HostName).
         Replace("{%ModulePath}", traceEvent.Location.ModulePath).
         Replace("{%Principal}", traceEvent.Principal.Name).
         Replace("{%ThreadName}", traceEvent.Location.ThreadName).
         Replace("{%Message}", traceEvent.Message).
         Replace("{%Source}", traceEvent.Location.Source).
         Replace("{%Type}", traceEvent.Type.ToString()).
         Replace("{%Category}", traceEvent.Category.ToString()).
         Replace("{%EventIdText}", traceEvent.EventIdText).
         Replace("{%Time}", traceEvent.Time.ToString("dd-MMM-yyyyTHH:mm:ss (fff)")).
         Replace("{%EventId}", traceEvent.EventId.ToString()
         );
     // TODO: Provide specific format handling for the DateTime (SD)
 }
开发者ID:alienwaredream,项目名称:toolsdotnet,代码行数:25,代码来源:PlaceHolderFormatter.cs


示例4: BeginIteration

 public override void BeginIteration(TraceEvent beginEvent)
 {
     _objects = new ListMetricInfo();
     _objects.clear();
     _objects.hasCount = true;
     _objects.hasBytes = true;
 }
开发者ID:visia,项目名称:xunit-performance,代码行数:7,代码来源:ObjectsAllocated_MainThreadMetricDiscoverer.cs


示例5: InstanceConfiguration

 public InstanceConfiguration(DataSetConfiguration dataSet, ObservableCollection<MessageHandlerConfiguration> availableHandlers, TraceEvent trace, Action onModification)
 {
     AvailableMessageHandlers = availableHandlers;
     AssociatedMessageHandlers = new ObservableCollection<MessageHandlerConfiguration>(availableHandlers.Where<MessageHandlerConfiguration>(x => x.Associated(dataSet.AssociationName)).ToArray<MessageHandlerConfiguration>());
     DataSetConfiguration = dataSet;
     PropertyChanged += (x, y) => onModification();
 }
开发者ID:yuriik83,项目名称:OPC-UA-OOI,代码行数:7,代码来源:InstanceConfigurationFactory.cs


示例6: TraceEvent

 public override void TraceEvent(TraceEventCache eventCache, string source, TraceEventType eventType, int id)
 {
     var te = new TraceEvent {Cache = eventCache, Source = source, Type = eventType, Id = id};
     Events.Add(te);
     if (OnEventAdd != null)
         OnEventAdd.Invoke(te);
 }
开发者ID:BastienDurel,项目名称:OCTGN,代码行数:7,代码来源:CacheTraceListener.cs


示例7: Trace

        /// <inheritdoc/>
        public override void Trace(TraceEvent traceEvent)
        {
            if (traceEvent == null)
            {
                throw new ArgumentNullException("traceEvent");
            }

            if (ShouldIgnore(traceEvent))
            {
                return;
            }

            try
            {
                foreach (TraceFilter filter in Filters)
                {
                    // trace must be passed to all filters (even if no notifications will be
                    // performed due to throttling) to allow them to continue to accumulate their results
                    if (filter.Filter(traceEvent))
                    {
                        // Notify all subscribers
                        Notify(filter);
                    }
                }
            }
            catch
            {
                // Need to prevent infinite loops when calling out to user code
                // I.e., user code exception in error handler causes error filter/subscriber
                // to be called again.
            }
        }
开发者ID:brendankowitz,项目名称:azure-webjobs-sdk-extensions,代码行数:33,代码来源:TraceMonitor.cs


示例8: EventReceived

        private void EventReceived(TraceEvent traceEvent)
        {
            DisplayTraceEvent dte = new DisplayTraceEvent
            {
                TraceEvent = traceEvent,
            };

            foreach (IDisplayTraceEvents idt in _viewers)
            {
                if (idt.IsApplicable(traceEvent))
                {
                    dte.DisplayTemplates.Add(idt.GetDisplayTemplate());

                    DataTemplate listTemplate = idt.GetListItemTemplate();

                    if (listTemplate != null)
                    {
                        dte.ListTemplate = listTemplate;
                    }
                }
            }

            DisplayTraceEvents.Add(dte);
            SelectedTab = 0;
        }
开发者ID:Balansir,项目名称:Backload,代码行数:25,代码来源:MainViewModel.cs


示例9: Trace

 public override void Trace(TraceEvent traceEvent)
 {
     // TODO: figure out the right log file format
     // TODO: buffer logs and write only periodically
     AppendLine(traceEvent.Message);
     if (traceEvent.Exception != null)
     {
         if (traceEvent.Exception is FunctionInvocationException ||
             traceEvent.Exception is AggregateException)
         {
             // we want to minimize the stack traces for function invocation
             // failures, so we drill into the very inner exception, which will
             // be the script error
             Exception actualException = traceEvent.Exception;
             while (actualException.InnerException != null)
             {
                 actualException = actualException.InnerException;
             }
             AppendLine(actualException.Message);
         }
         else
         {
             AppendLine(traceEvent.Exception.ToString());
         }
     }
 }
开发者ID:cmatskas,项目名称:azure-webjobs-sdk-script,代码行数:26,代码来源:FileTraceWriter.cs


示例10: InvokeTextWriter

        protected override void InvokeTextWriter(TraceEvent traceEvent)
        {
            if (MapTraceLevel(traceEvent.Source, traceEvent.Level) <= _traceConfig.ConsoleLevel)
            {
                // For Errors/Warnings we change the Console color
                // for visibility
                var holdColor = Console.ForegroundColor;
                bool changedColor = false;
                switch (traceEvent.Level)
                {
                    case TraceLevel.Error:
                        Console.ForegroundColor = ConsoleColor.Red;
                        changedColor = true;
                        break;
                    case TraceLevel.Warning:
                        Console.ForegroundColor = ConsoleColor.Yellow;
                        changedColor = true;
                        break;
                }

                base.InvokeTextWriter(traceEvent);

                if (changedColor)
                {
                    Console.ForegroundColor = holdColor;
                }
            }         
        }
开发者ID:chungvinhkhang,项目名称:azure-webjobs-sdk,代码行数:28,代码来源:ConsoleTraceWriter.cs


示例11: Write

 public override void Write(string message)
 {
     var te = new TraceEvent
                  {Cache = new TraceEventCache(), Message = message, Type = TraceEventType.Information};
     Events.Add(te);
     if (OnEventAdd != null)
         OnEventAdd.Invoke(te);
 }
开发者ID:BastienDurel,项目名称:OCTGN,代码行数:8,代码来源:CacheTraceListener.cs


示例12: ProcessAction

 public unsafe ProcessAction(TraceEvent traceEvent)
 {
     EventName = traceEvent.EventName;
     OpcodeName = traceEvent.OpcodeName;
     PayloadNames = traceEvent.PayloadNames;
     //
     AffectedKeys = new AffectedKeys(traceEvent);
 }
开发者ID:Evlikat,项目名称:incinerate,代码行数:8,代码来源:ProcessAction.cs


示例13: Write

 public override void Write(string message)
 {
     TraceEvent te = new TraceEvent();
     te.Cache = new TraceEventCache();
     te.Message = message;
     te.Type = TraceEventType.Information;
     Events.Add(te);
     if(OnEventAdd != null)
         OnEventAdd.Invoke(te);
 }
开发者ID:YoshiEnVerde,项目名称:OCTGN,代码行数:10,代码来源:CacheTraceListener.cs


示例14: Trace

        public override void Trace(TraceEvent traceEvent)
        {
            if (Level < traceEvent.Level)
            {
                return;
            }

            _interceptor(traceEvent);
            InnerWriter.Trace(traceEvent);
        }
开发者ID:Azure,项目名称:azure-webjobs-sdk-script,代码行数:10,代码来源:InterceptingTraceWriter.cs


示例15: TraceEvent

 public override void TraceEvent(TraceEventCache eventCache, string source, TraceEventType eventType, int id)
 {
     TraceEvent te = new TraceEvent();
     te.Cache = eventCache;
     te.Source = source;
     te.Type = eventType;
     te.ID = id;
     Events.Add(te);
     if(OnEventAdd != null)
         OnEventAdd.Invoke(te);
 }
开发者ID:YoshiEnVerde,项目名称:OCTGN,代码行数:11,代码来源:CacheTraceListener.cs


示例16: InvokeTraceWriters

 protected virtual void InvokeTraceWriters(TraceEvent traceEvent)
 {
     foreach (TraceWriter traceWriter in _innerTraceWriters)
     {
         // filter based on level before delegating
         if (traceWriter.Level >= traceEvent.Level)
         {
             traceWriter.Trace(traceEvent);
         }
     }
 }
开发者ID:jonkelling,项目名称:azure-webjobs-sdk,代码行数:11,代码来源:CompositeTraceWriter.cs


示例17: Trace

		public void Trace(TraceEvent traceEvent)
		{
			foreach (var source in this.sources)
			{
				var diagnostics = source as IDiagnosticsTraceSource;
				if (diagnostics != null)
					diagnostics.Trace(this.originalSourceName, traceEvent);
				else
					source.Trace(traceEvent);
			}
		}
开发者ID:netfx,项目名称:extensions,代码行数:11,代码来源:AggregateTraceSource.cs


示例18: Trace

        public override void Trace(TraceEvent traceEvent)
        {
            if (Level < traceEvent.Level)
            {
                return;
            }

            if (_predicate(traceEvent))
            {
                InnerWriter.Trace(traceEvent);
            }
        }
开发者ID:Azure,项目名称:azure-webjobs-sdk-script,代码行数:12,代码来源:ConditionalTraceWriter.cs


示例19: TraceEvent

 public override void TraceEvent(TraceEventCache eventCache, string source, TraceEventType eventType, int id)
 {
     var te = new TraceEvent {Cache = eventCache, Source = source, Type = eventType, Id = id};
     Events.Add(te);
     try
     {
         if (Events.Count > 1000)
             Events.RemoveAt(0);
     }
     catch (Exception) { }
     if (OnEventAdd != null)
         OnEventAdd.Invoke(te);
 }
开发者ID:sbarnabas,项目名称:OCTGN,代码行数:13,代码来源:CacheTraceListener.cs


示例20: Trace

        public override void Trace(TraceEvent traceEvent)
        {
            if (traceEvent == null)
            {
                throw new ArgumentNullException("traceEvent");
            }

            // Apply our top level trace filter first
            if (Level >= traceEvent.Level)
            {
                InvokeTraceWriters(traceEvent);
                InvokeTextWriter(traceEvent);
            }
        }
开发者ID:jonkelling,项目名称:azure-webjobs-sdk,代码行数:14,代码来源:CompositeTraceWriter.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# TraceEventCache类代码示例发布时间:2022-05-24
下一篇:
C# Trace类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap