Ejemplo n.º 1
0
        internal static string LookupSeverity(TraceEventLevel level, TraceEventOpcode opcode)
        {
            string severity;

            if (opcode == TraceEventOpcode.Info)
            {
                switch (level)
                {
                case TraceEventLevel.Critical:
                    severity = "Critical";
                    break;

                case TraceEventLevel.Error:
                    severity = "Error";
                    break;

                case TraceEventLevel.Warning:
                    severity = "Warning";
                    break;

                case TraceEventLevel.Informational:
                    severity = "Information";
                    break;

                case TraceEventLevel.Verbose:
                    severity = "Verbose";
                    break;

                default:
                    severity = level.ToString();
                    break;
                }
            }
            else
            {
                switch (opcode)
                {
                case TraceEventOpcode.Start:
                    severity = "Start";
                    break;

                case TraceEventOpcode.Stop:
                    severity = "Stop";
                    break;

                case TraceEventOpcode.Suspend:
                    severity = "Suspend";
                    break;

                case TraceEventOpcode.Resume:
                    severity = "Resume";
                    break;

                default:
                    severity = opcode.ToString();
                    break;
                }
            }
            return(severity);
        }
Ejemplo n.º 2
0
 internal static string LookupSeverity(TraceEventLevel level, TraceEventOpcode opcode)
 {
     string severity;
     if (opcode == TraceEventOpcode.Info)
     {
         switch (level)
         {
             case TraceEventLevel.Critical:
                 severity = "Critical";
                 break;
             case TraceEventLevel.Error:
                 severity = "Error";
                 break;
             case TraceEventLevel.Warning:
                 severity = "Warning";
                 break;
             case TraceEventLevel.Informational:
                 severity = "Information";
                 break;
             case TraceEventLevel.Verbose:
                 severity = "Verbose";
                 break;
             default:
                 severity = level.ToString();
                 break;
         }
     }
     else
     {
         switch (opcode)
         {
             case TraceEventOpcode.Start:
                 severity = "Start";
                 break;
             case TraceEventOpcode.Stop:
                 severity = "Stop";
                 break;
             case TraceEventOpcode.Suspend:
                 severity = "Suspend";
                 break;
             case TraceEventOpcode.Resume:
                 severity = "Resume";
                 break;
             default:
                 severity = opcode.ToString();
                 break;
         }
     }
     return severity;
 }
Ejemplo n.º 3
0
        protected virtual void InternalWrite(TraceEventLevel level, string message)
        {
            var internalMessage       = string.Format("[{0}]: {1}", level, message);
            var internalOutputMessage = internalMessage;

            if (TraceEventFormatter != null)
            {
                internalOutputMessage = TraceEventFormatter.FormatEvent(new TraceEventFormatOptions
                {
                    Level     = level.ToString(),
                    Message   = message,
                    TimeStamp = DateTime.Now
                });
            }

            if (IsConsoleWriterEnabled)
            {
                Out.WriteLine(internalOutputMessage);
            }

            if (IsTraceWriterEnabled)
            {
                Trace.WriteLine(internalOutputMessage);
            }

            if (IsDebugWriterEnabled)
            {
                Trace.WriteLine(internalOutputMessage);
            }

            if (IsFileWriterEnabled)
            {
                using (var sw = File.AppendText(LogFilePath))
                    sw.WriteLine(internalOutputMessage);
            }

            InvokeOnTraceMessage(new TraceEventEventArgs
            {
                Level   = level,
                Message = message
            });
        }
        internal static string LookupSeverity(TraceEventLevel level, TraceEventOpcode opcode)
        {
            switch (opcode)
            {
                case TraceEventOpcode.Start:
                    return "Start";

                case TraceEventOpcode.Stop:
                    return "Stop";

                case TraceEventOpcode.Resume:
                    return "Resume";

                case TraceEventOpcode.Suspend:
                    return "Suspend";

                case TraceEventOpcode.Info:
                    switch (level)
                    {
                        case TraceEventLevel.Critical:
                            return "Critical";

                        case TraceEventLevel.Error:
                            return "Error";

                        case TraceEventLevel.Warning:
                            return "Warning";

                        case TraceEventLevel.Informational:
                            return "Information";

                        case TraceEventLevel.Verbose:
                            return "Verbose";
                    }
                    return level.ToString();
            }
            return opcode.ToString();
        }
        internal static string LookupSeverity(TraceEventLevel level, TraceEventOpcode opcode)
        {
            switch (opcode)
            {
            case TraceEventOpcode.Start:
                return("Start");

            case TraceEventOpcode.Stop:
                return("Stop");

            case TraceEventOpcode.Resume:
                return("Resume");

            case TraceEventOpcode.Suspend:
                return("Suspend");

            case TraceEventOpcode.Info:
                switch (level)
                {
                case TraceEventLevel.Critical:
                    return("Critical");

                case TraceEventLevel.Error:
                    return("Error");

                case TraceEventLevel.Warning:
                    return("Warning");

                case TraceEventLevel.Informational:
                    return("Information");

                case TraceEventLevel.Verbose:
                    return("Verbose");
                }
                return(level.ToString());
            }
            return(opcode.ToString());
        }
Ejemplo n.º 6
0
        internal static string LookupSeverity(TraceEventLevel level, TraceEventOpcode opcode)
        {
            string           str;
            TraceEventOpcode traceEventOpcode = opcode;

            switch (traceEventOpcode)
            {
            case TraceEventOpcode.Start:
            {
                str = "Start";
                break;
            }

            case TraceEventOpcode.Stop:
            {
                str = "Stop";
                break;
            }

            default:
            {
                switch (traceEventOpcode)
                {
                case TraceEventOpcode.Resume:
                {
                    str = "Resume";
                    return(str);
                }

                case TraceEventOpcode.Suspend:
                {
                    str = "Suspend";
                    return(str);
                }

                default:
                {
                    TraceEventLevel traceEventLevel = level;
                    switch (traceEventLevel)
                    {
                    case TraceEventLevel.Critical:
                    {
                        str = "Critical";
                        return(str);
                    }

                    case TraceEventLevel.Error:
                    {
                        str = "Error";
                        return(str);
                    }

                    case TraceEventLevel.Warning:
                    {
                        str = "Warning";
                        return(str);
                    }

                    case TraceEventLevel.Informational:
                    {
                        str = "Information";
                        return(str);
                    }

                    case TraceEventLevel.Verbose:
                    {
                        str = "Verbose";
                        return(str);
                    }
                    }
                    break;
                }
                }
                str = level.ToString();
                break;
            }
            break;
            }
            return(str);
        }
Ejemplo n.º 7
0
		internal static string LookupSeverity(TraceEventLevel level, TraceEventOpcode opcode)
		{
			string str;
			TraceEventOpcode traceEventOpcode = opcode;
			switch (traceEventOpcode)
			{
				case TraceEventOpcode.Start:
				{
					str = "Start";
					break;
				}
				case TraceEventOpcode.Stop:
				{
					str = "Stop";
					break;
				}
				default:
				{
					switch (traceEventOpcode)
					{
						case TraceEventOpcode.Resume:
						{
							str = "Resume";
							return str;
						}
						case TraceEventOpcode.Suspend:
						{
							str = "Suspend";
							return str;
						}
						default:
						{
							TraceEventLevel traceEventLevel = level;
							switch (traceEventLevel)
							{
								case TraceEventLevel.Critical:
								{
									str = "Critical";
									return str;
								}
								case TraceEventLevel.Error:
								{
									str = "Error";
									return str;
								}
								case TraceEventLevel.Warning:
								{
									str = "Warning";
									return str;
								}
								case TraceEventLevel.Informational:
								{
									str = "Information";
									return str;
								}
								case TraceEventLevel.Verbose:
								{
									str = "Verbose";
									return str;
								}
							}
							break;
						}
					}
					str = level.ToString();
					break;
				}
				break;
			}
			return str;
		}