Ejemplo n.º 1
0
        public static void WriteLine(string message, Connection channel, NetTraceCategory category)
        {
            //Console.WriteLine(NetTrace.GetMessage(message, channel));
            if (!NetTrace.Enabled)
            {
                return;
            }

            if (!NetTrace.ValidateCategory(category))
            {
                return;
            }

            Trace.WriteLine(
                NetTrace.GetMessage(message, channel),
                NetTrace.GetCategoryName(category)
                );
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets whether the specified category is enabled or not
        /// </summary>
        private static bool ValidateCategory(NetTraceCategory category)
        {
            switch (category)
            {
            case NetTraceCategory.Channel: return(NetTrace.TraceChannel);

            case NetTraceCategory.Http: return(NetTrace.TraceHttp);

            case NetTraceCategory.Emitter: return(NetTrace.TraceEmitter);

            case NetTraceCategory.WebSocket: return(NetTrace.TraceWebSocket);

            case NetTraceCategory.Ssl: return(NetTrace.TraceSsl);

            case NetTraceCategory.Rest: return(NetTrace.TraceRest);

            case NetTraceCategory.Mesh: return(NetTrace.TraceMesh);

            case NetTraceCategory.Mqtt: return(NetTrace.TraceMqtt);

            default: return(true);
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Gets the category string to print in the message.
 /// </summary>
 private static string GetCategoryName(NetTraceCategory category)
 {
     return(Enum.GetName(typeof(NetTraceCategory), category).ToUpper());
 }
Ejemplo n.º 4
0
        public static void WriteLineIf(bool condition, string message, Connection channel, NetTraceCategory category)
        {
            if (!NetTrace.Enabled)
            {
                return;
            }

            if (!NetTrace.ValidateCategory(category))
            {
                return;
            }

            Trace.WriteLineIf(
                condition,
                NetTrace.GetMessage(message, channel),
                NetTrace.GetCategoryName(category)
                );
        }