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


C# TraceEventType.ToString方法代码示例

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


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

示例1: TraceEvent

 // ReSharper restore MethodOverloadWithOptionalParameter
 // ReSharper disable MethodOverloadWithOptionalParameter
 public override void TraceEvent(TraceEventCache eventCache, string source, TraceEventType eventType, int id, string format, params object[] args)
 {
     // ReSharper disable ConditionIsAlwaysTrueOrFalse
     if (args == null)
     // ReSharper restore ConditionIsAlwaysTrueOrFalse
     // ReSharper disable HeuristicUnreachableCode
     {
         _traceLog.Clients.All.traceEvent(source, eventType.ToString(), id, format, args);
     }
     // ReSharper restore HeuristicUnreachableCode
     else
     {
         _traceLog.Clients.All.traceEvent(source, eventType.ToString(), id, string.Format(CultureInfo.InvariantCulture, format, args));
     }
 }
开发者ID:sadeghsm,项目名称:ChronoZoom,代码行数:17,代码来源:SignalRTraceListener.cs

示例2: TraceSimpleEvent

        protected override void TraceSimpleEvent(DateTime eventTime, Int32 threadId, TraceEventType eventType, String message, Int32 eventId, TraceEventCache eventCache, String source)
        {
            if (_table != null)
            {
                if (message.StartsWith("#Status ") || message.StartsWith("#Status:"))
                {
                    Status status = new Status(eventTime.ToUniversalTime());
                    status.Level = eventType.ToString();
                    status.ThreadId = threadId;

                    string messageText;
                    string dataText;
                    GetMessageParts(message, out messageText, out dataText);
                    status.Message = messageText;
                    status.Data = dataText;

                    try
                    {
                        TableOperation operation = TableOperation.Insert(status);
                        this._table.Execute(operation);
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine("Exception while saving to Azure storage.");
                        Console.WriteLine(e.ToString());
                        throw;
                    }
                }
            }
        }
开发者ID:jinujoseph,项目名称:NuGet.Services.Metadata,代码行数:30,代码来源:AzureTableStorageStatusTraceListener.cs

示例3: TraceEvent

 public override void TraceEvent(TraceEventCache eventCache, string source, TraceEventType eventType, int id, string message)
 {
     var levelChar = eventType.ToString().Substring(0, 1).ToUpper();
     var dateFormat = DateTime.Now.ToString("0:MM/dd/yy H:mm:ss");
     string fmt = string.Format("{0} {1} {2} ({3})", DateTime.Now.ToString(), levelChar, message, source);
     this.WriteLine(fmt);
 }
开发者ID:rossandon,项目名称:SpotifyJukebox,代码行数:7,代码来源:TraceListener.cs

示例4: TraceData

 public override void TraceData(TraceEventCache eventCache, string source, TraceEventType eventType, int id, object data)
 {
     if ((Filter != null) && !Filter.ShouldTrace(eventCache, source, eventType, id, null, null, data, null))
         return;
     var message = data.ToString();
     WriteLine(message, eventType.ToString());
 }
开发者ID:MRCollective,项目名称:AzureTraceListeners,代码行数:7,代码来源:AzureTraceListener.cs

示例5: TraceEvent

 public override void TraceEvent(TraceEventCache eventCache, string source, TraceEventType eventType, int id, string message)
 {
     if (eventType == TraceEventType.Information) {
         WriteLine(String.Format("{0:HH:mm:ss.ffff} - {1}", eventCache.DateTime.ToLocalTime(), message));
     } else {
         WriteLine(String.Format("{0:HH:mm:ss.ffff} - {1}: {2}", eventCache.DateTime.ToLocalTime(), eventType.ToString().ToUpper(), message));
     }
 }
开发者ID:zeffy,项目名称:huehax,代码行数:8,代码来源:TextBoxTraceListener.cs

示例6: AppendHeader

 private static void AppendHeader(this StringBuilder builder, string source, TraceEventType eventType, int id, string delimiter = DefaultDelimiter)
 {
     builder.Append(EscapedString(source));
     builder.Append(delimiter);
     builder.Append(eventType.ToString());
     builder.Append(delimiter);
     builder.Append(id.ToString(CultureInfo.InvariantCulture));
     builder.Append(delimiter);
 }
开发者ID:ChuangYang,项目名称:corefx,代码行数:9,代码来源:CommonUtilities.cs

示例7: MessageWithTraceEventType

 protected string MessageWithTraceEventType(TraceEventType traceEventType, string message)
 {
     string traceEventTypeString;
     if (!TraceEventTypeStrings.TryGetValue(traceEventType, out traceEventTypeString))
     {
         traceEventTypeString = traceEventType.ToString();
     }
     return string.Format(CultureInfo.InvariantCulture, MessageWithTraceEventTypeFormat, traceEventTypeString, message);
 }
开发者ID:joyhui,项目名称:NuGet.Jobs,代码行数:9,代码来源:JobTraceListener.cs

示例8: TestTraceListenerThrowsOnErrorOrWarning

        public void TestTraceListenerThrowsOnErrorOrWarning(TraceEventType traceEventType)
        {
            // Given
            Engine engine = new Engine();
            engine.Trace.AddListener(new TestTraceListener());
            engine.Pipelines.Add(new Trace(traceEventType.ToString()).EventType(traceEventType));

            // When/Then
            Assert.Throws<Exception>(() => engine.Execute());
        }
开发者ID:martinvobr,项目名称:Wyam,代码行数:10,代码来源:TraceFixture.cs

示例9: TestTraceListenerThrows

            public void TestTraceListenerThrows(TraceEventType traceEventType)
            {
                // Given
                Engine engine = new Engine();
                engine.Pipelines.Add(new Trace(traceEventType.ToString()).EventType(traceEventType));

                // When
                TestDelegate test = () => engine.Execute();

                // Then
                Assert.Throws<Exception>(test);
            }
开发者ID:ibebbs,项目名称:Wyam,代码行数:12,代码来源:TraceTests.cs

示例10: Log

        public void Log(TraceEventType type, Exception ex, IDictionary<string, object> additionalInfo, string messageFormat, params object[] args)
        {
            string messageText = args == null || args.Length == 0 ? messageFormat : String.Format(messageFormat, args);
            string spiedMessage = String.Format("[{0}] {1}", type.ToString().ToUpperInvariant(), messageText);

            for (; ex != null; ex = ex.InnerException)
                spiedMessage += String.Format("\r\nEXCEPTION:\r\n{0}", ex);

            if (additionalInfo != null && additionalInfo.Count != 0)
                spiedMessage += String.Format("\r\nADDITIONAL INFO: {0}", String.Join(", ", additionalInfo.Select(kvp => String.Format("{0} = {1}", kvp.Key, kvp.Value))));

            Messages.Add(spiedMessage);
        }
开发者ID:diwakarpp,项目名称:ElasticLINQ,代码行数:13,代码来源:SpyLog.cs

示例11: TraceEvent

        public override void TraceEvent(TraceEventCache eventCache, string source, TraceEventType eventType, int id, string message)
        {
            if (this.Filter != null && !this.Filter.ShouldTrace(eventCache, source, eventType, id, message, null, null, null))
                return;

            StackTrace stackTrace = new StackTrace(true);
            StackFrame[] stackFrames = stackTrace.GetFrames();

            this.Writer.WriteLine("<entry date='" + Gateway.Now.ToShortDateString() + "' time='" + Gateway.Now.ToShortTimeString() + "' type='" +
                 eventType.ToString() + "' chainId='" + id + "'>" +
                "<sender class='" + stackFrames[3].GetMethod().ReflectedType.Name + "." + stackFrames[3].GetMethod().Name + "' line='" + stackFrames[3].GetFileLineNumber() + "' />" +
                "<message>" + message + "</message></entry>");
        }
开发者ID:ISISComputingGroup,项目名称:EPICS-epicssharp,代码行数:13,代码来源:GWFileTraceListener.cs

示例12: Write

 public void Write( TraceEventType eventType, string message )
 {
     StreamWriter writer = File.AppendText( filename );
     try
     {
         writer.WriteLine( "[{0:yyyy-MM-dd HH:mm:ss.fff}] {1}: {2}",
             DateTime.Now, eventType.ToString(), message );
     }
     finally
     {
         writer.Close();
     }
 }
开发者ID:tkrehbiel,项目名称:UvMoney,代码行数:13,代码来源:FlatFileLogger.cs

示例13: SendCampfireMessage

        private void SendCampfireMessage(TraceEventCache eventCache, string source, TraceEventType eventType, int id, params object[] data)
        {
            // iterate through the data and create a single message
            StringBuilder sb = new StringBuilder();

            foreach (object item in data.Where(item => item != null))
                sb.Append(item);

            // Source LogLevel (id): message
            string message = string.Format("{0} {1} ({2}): {3}", source, eventType.ToString(), id, sb.ToString());

            _client.Post(message);
        }
开发者ID:mfanto,项目名称:CampfireTraceListener,代码行数:13,代码来源:CampfireTraceListener.cs

示例14: WriteEvent

 private static void WriteEvent(TraceEventType eventType, CompositionTraceId traceId, string format, params object[] arguments)
 {
     const string LEVEL = "Level = ";
     const string ID = " ,Id = ";
     const string NEW_LINE = "\r\n";
     StringBuilder sb = new StringBuilder (60);
     sb.Append (LEVEL);
     sb.Append (eventType);
     sb.Append (ID);
     sb.Append (traceId);
     sb.Append (NEW_LINE);
     sb.AppendFormat (format, arguments);
     var mssage = eventType.ToString() + string.Format(format, arguments);
 }
开发者ID:grothag,项目名称:pocketmef,代码行数:14,代码来源:TraceSourceTraceWriter.cs

示例15: CreateLogMessage

        internal static string CreateLogMessage(TraceEventType eventType, CompositionTraceId traceId, string format, params object[] arguments)
        {
            StringBuilder messageBuilder = new StringBuilder();

            // Format taken from TraceListener.TraceEvent in full framework
            messageBuilder.AppendFormat(CultureInfo.InvariantCulture, "{0} {1}: {2} : ",
                s_sourceName, eventType.ToString(), (int)traceId);

            if (arguments == null)
            {
                messageBuilder.Append(format);
            }
            else
            {
                messageBuilder.AppendFormat(CultureInfo.InvariantCulture, format, arguments);
            }

            messageBuilder.AppendLine();

            return messageBuilder.ToString();
        }
开发者ID:noahfalk,项目名称:corefx,代码行数:21,代码来源:DebuggerTraceWriter.cs


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