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

C# TraceEventCache类代码示例

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

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



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

示例1: ProcessIdTest

 public void ProcessIdTest()
 {
     var cache = new TraceEventCache();
     var id = cache.ProcessId;
     var expected = System.Diagnostics.Process.GetCurrentProcess().Id;
     Assert.Equal((int)expected, id);
 }
开发者ID:dotnet,项目名称:corefx,代码行数:7,代码来源:TraceEventCacheClassTests.cs


示例2: ShouldTrace

 public void ShouldTrace()
 {
     var cache = new TraceEventCache();
     var filter = new EventTypeFilter(SourceLevels.Error);
     Assert.True(filter.ShouldTrace(cache, null, TraceEventType.Critical, 0, null, null, null, null));
     Assert.False(filter.ShouldTrace(cache, null, TraceEventType.Warning, 0, null, null, null, null));
 }
开发者ID:noahfalk,项目名称:corefx,代码行数:7,代码来源:EventTypeFilterClassTests.cs


示例3: ThreadIdTest

 public void ThreadIdTest()
 {
     var cache = new TraceEventCache();
     var id = cache.ThreadId;
     Assert.NotNull(id);
     Assert.NotEqual("", id);
 }
开发者ID:dotnet,项目名称:corefx,代码行数:7,代码来源:TraceEventCacheClassTests.cs


示例4: TraceData

 public override void TraceData(TraceEventCache eventCache, string source, TraceEventType eventType, int id, object data)
 {
     if (data is LogEntry)
     {
         this.Write(baseModel.Serialize(new LogMessageModel(data as LogEntry)).DocumentElement.OuterXml);
     }
 }
开发者ID:jordivila,项目名称:Net_MVC_NLayer_Generator,代码行数:7,代码来源:CustomTraceListenerRollingXml.cs


示例5: TimestampTest

 public void TimestampTest()
 {
     var cache = new TraceEventCache();
     var dt1 = cache.Timestamp;
     var dt2 = cache.Timestamp;
     Assert.Equal(dt1, dt2);
 }
开发者ID:dotnet,项目名称:corefx,代码行数:7,代码来源:TraceEventCacheClassTests.cs


示例6: ShouldTraceTest

 public void ShouldTraceTest()
 {
     var sourceName = "TestSource";
     var cache = new TraceEventCache();
     var filter = new SourceFilter(sourceName);
     Assert.True(filter.ShouldTrace(cache, sourceName, TraceEventType.Critical, 0, null, null, null, null));
     Assert.False(filter.ShouldTrace(cache, "Default", TraceEventType.Warning, 0, null, null, null, null));
     Assert.Throws<ArgumentNullException>(() => filter.ShouldTrace(cache, null, TraceEventType.Warning, 0, null, null, null, null));
 }
开发者ID:noahfalk,项目名称:corefx,代码行数:9,代码来源:SourceFilterClassTests.cs


示例7: DateTimePropertyTest

 public void DateTimePropertyTest()
 {
     var cache = new TraceEventCache();
     var begin = DateTime.UtcNow;
     var dt = cache.DateTime;
     var end = DateTime.UtcNow;
     Assert.True(dt >= begin);
     Assert.True(dt <= end);
     var cached = cache.DateTime;
     Assert.Equal(dt, cached);
 }
开发者ID:dotnet,项目名称:corefx,代码行数:11,代码来源:TraceEventCacheClassTests.cs


示例8: TraceEvent_FormatString_Test

        public void TraceEvent_FormatString_Test(TraceFilter filter, TraceEventCache eventCache, string source, TraceEventType eventType, int id, string format, object[] args)
        {
            using (var target = new DelimitedListTraceListener(_stream))
            {
                target.Filter = filter;
                target.TraceOutputOptions = TraceOptions.ProcessId | TraceOptions.ThreadId | TraceOptions.DateTime | TraceOptions.Timestamp;
                target.TraceEvent(eventCache, source, eventType, id, format, args);
            }

            string expected = CommonUtilities.ExpectedTraceEventOutput(filter, eventCache, source, eventType, id, format, args);
            Assert.Equal(expected, File.ReadAllText(_fileName));
        }
开发者ID:er0dr1guez,项目名称:corefx,代码行数:12,代码来源:DelimiterWriteMethodTests.cs


示例9: ExpectedTraceEventOutput

        internal static string ExpectedTraceEventOutput(TraceFilter filter, TraceEventCache cache, string source, TraceEventType eventType, int id, string format, object[] args)
        {
            if (filter != null && !filter.ShouldTrace(cache, source, eventType, id, format, args, null, null))
                return string.Empty;

            var builder = new StringBuilder();
            builder.AppendHeader(source, eventType, id);
            builder.Append(EscapedString(args != null ? string.Format(format, args) : format));
            builder.Append(DefaultDelimiter);
            builder.Append(DefaultDelimiter);
            builder.AppendTraceEventCache(cache);
            return builder.AppendLine().ToString();
        }
开发者ID:ChuangYang,项目名称:corefx,代码行数:13,代码来源:CommonUtilities.cs


示例10: ExpectedTraceDataOutput

        internal static string ExpectedTraceDataOutput(TraceFilter filter, TraceEventCache cache, string source, TraceEventType eventType, int id, object data)
        {
            if (filter != null && !filter.ShouldTrace(cache, source, eventType, id, null, null, data, null))
                return string.Empty;

            var builder = new StringBuilder();
            builder.AppendHeader(source, eventType, id);
            builder.Append(DefaultDelimiter);
            builder.Append(EscapedString(data.ToString()));
            builder.Append(DefaultDelimiter);
            builder.AppendTraceEventCache(cache);
            return builder.AppendLine().ToString();
        }
开发者ID:ChuangYang,项目名称:corefx,代码行数:13,代码来源:CommonUtilities.cs


示例11: LogicalOperationStack

 public void LogicalOperationStack()
 {
     var cache = new TraceEventCache();
     var logicalOperationStack = cache.LogicalOperationStack; 
     Assert.Equal(0, logicalOperationStack.Count);
     Trace.CorrelationManager.StartLogicalOperation("SecondaryThread");
     Trace.CorrelationManager.StartLogicalOperation("MainThread");
     Assert.NotNull(logicalOperationStack);
     Assert.Equal(2, logicalOperationStack.Count);
     Assert.Equal("MainThread", logicalOperationStack.Pop().ToString());
     Assert.Equal("SecondaryThread", logicalOperationStack.Peek().ToString());
     Trace.CorrelationManager.StopLogicalOperation();
     Assert.Equal(0, logicalOperationStack.Count);
 }
开发者ID:dotnet,项目名称:corefx,代码行数:14,代码来源:TraceEventCacheClassTests.cs


示例12: TraceData

 public override void TraceData(TraceEventCache eventCache, string source, TraceEventType eventType, int id, object data)
 {
     if (data is LogEntry)
     {
         // Check Channel State otherwise can generate loop errors
         if (this.proxyLogging.State == CommunicationState.Opened)
         {
             Guid guid = this.proxyLogging.LoggingExceptionSet(data as LogEntry);
         }
     }
     else
     {
         //this.WriteLine(data.ToString());
     }
 }
开发者ID:jordivila,项目名称:Net_MVC_NLayer_Generator,代码行数:15,代码来源:CustomTraceListenerProxiedWCF.cs


示例13: AppendTraceEventCache

 private static void AppendTraceEventCache(this StringBuilder builder, TraceEventCache cache, string delimiter = DefaultDelimiter)
 {
     if (cache != null)
     {
         builder.Append(cache.ProcessId);
         builder.Append(delimiter);
         builder.Append(EscapedString(cache.ThreadId));
         builder.Append(delimiter);
         builder.Append(EscapedString(cache.DateTime.ToString("o", CultureInfo.InvariantCulture)));
         builder.Append(delimiter);
         builder.Append(cache.Timestamp.ToString(CultureInfo.InvariantCulture));
         builder.Append(delimiter);
     }
     else
     {
         for (int i = 0; i < 5; ++i)
             builder.Append(delimiter);
     }
 }
开发者ID:ChuangYang,项目名称:corefx,代码行数:19,代码来源:CommonUtilities.cs


示例14: TraceEvent

        public sealed override void TraceEvent(TraceEventCache eventCache, string source, TraceEventType eventType, int id, string message)
        {
            if (!_provider.IsEnabled())
            {
                return;
            }

            if (Filter != null && !Filter.ShouldTrace(eventCache, source, eventType, id, null, null, null, null))
            {
                return;
            }

            StringBuilder dataString = new StringBuilder(s_defaultPayloadSize);
            dataString.Append(message);

            _provider.WriteMessageEvent(dataString.ToString(),
                            (byte)eventType,
                            (long)eventType & s_keyWordMask);
        }
开发者ID:40a,项目名称:PowerShell,代码行数:19,代码来源:EventProviderTraceListener.cs


示例15: TraceData

        public sealed override void TraceData(TraceEventCache eventCache, String source, TraceEventType eventType, int id, params object[] data)
        {
            if (!_provider.IsEnabled())
            {
                return;
            }

            if (Filter != null && !Filter.ShouldTrace(eventCache, source, eventType, id, null, null, null, null))
            {
                return;
            }

            int index;
            StringBuilder dataString = new StringBuilder(s_defaultPayloadSize);

            if ((data != null) && (data.Length > 0))
            {
                for (index = 0; index < (data.Length - 1); index++)
                {
                    if (data[index] != null)
                    {
                        dataString.Append(data[index].ToString());
                        dataString.Append(Delimiter);
                    }
                    else
                    {
                        dataString.Append(s_nullStringComaValue);
                    }
                }

                if (data[index] != null)
                {
                    dataString.Append(data[index].ToString());
                }
                else
                {
                    dataString.Append(s_nullStringValue);
                }
            }
            else
            {
                dataString.Append(s_nullStringValue);
            }

            _provider.WriteMessageEvent(dataString.ToString(),
                            (byte)eventType,
                            (long)eventType & s_keyWordMask);
        }
开发者ID:40a,项目名称:PowerShell,代码行数:48,代码来源:EventProviderTraceListener.cs


示例16: TraceData

 public virtual void TraceData(TraceEventCache eventCache, string source, TraceEventType eventType, int id, object[] data)
 {
 }
开发者ID:Pengfei-Gao,项目名称:source-Insight-3-for-centos7,代码行数:3,代码来源:TraceListener.cs


示例17: TraceTransfer

 public virtual void TraceTransfer(TraceEventCache eventCache, string source, int id, string message, System.Guid relatedActivityId)
 {
 }
开发者ID:Pengfei-Gao,项目名称:source-Insight-3-for-centos7,代码行数:3,代码来源:TraceListener.cs


示例18: TraceEvent

 public virtual void TraceEvent(TraceEventCache eventCache, string source, TraceEventType eventType, int id, string format, object[] args)
 {
 }
开发者ID:Pengfei-Gao,项目名称:source-Insight-3-for-centos7,代码行数:3,代码来源:TraceListener.cs


示例19: ShouldTrace

 public abstract bool ShouldTrace(TraceEventCache cache, string source, TraceEventType eventType, int id, string formatOrMessage, object[] args, object data1, object[] data);
开发者ID:scott156,项目名称:corefx-progress,代码行数:1,代码来源:System.Diagnostics.TraceSource.cs


示例20: TraceEvent

 public override void TraceEvent(TraceEventCache eventCache, string source, TraceEventType eventType, int id, string message);
开发者ID:ellismg,项目名称:corefx-progress,代码行数:1,代码来源:System.Diagnostics.TextWriterTraceListener.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# TraceEventType类代码示例发布时间:2022-05-24
下一篇:
C# TraceEvent类代码示例发布时间: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