Ejemplo n.º 1
0
        public static void TraceEvent(
            this ITrace trace,
            bool convertNamedFormatTokens,
            TraceEventType traceEventType,
            int eventId,
            Exception exception,
            string message,
            params object[] args)
        {
            if (trace == null)
            {
                throw new ArgumentNullException(nameof(trace));
            }
            if (!trace.ShouldTrace(traceEventType))
            {
                return;
            }
            StringBuilder sb
                = TraceMessageHelper.FormatTraceMessage(
                      convertNamedFormatTokens,
                      exception,
                      message,
                      args);

            if (sb.Length != 0)
            {
                trace.TraceEvent(traceEventType, eventId, sb.ToString());
            }
        }
Ejemplo n.º 2
0
 public override string ToString()
 => TraceMessageHelper.FormatTraceMessage(Prefix, ConvertNamedFormatTokens, Exception, Message, FormatArgs)
 .ToString();
Ejemplo n.º 3
0
 public static StringBuilder FormatTraceMessage(
     bool convertNamedFormatTokens,
     Exception exception,
     string message,
     params object[] args)
 => TraceMessageHelper.FormatTraceMessage(null, convertNamedFormatTokens, exception, message, args);