Esempio n. 1
0
        internal static void TraceEvent(IndentLevel traceLevel, Func <string> message)
        {
            var lTraceSink = DebugView.traceSink;

            if (lTraceSink == null)
            {
                return;
            }

            string messageStr = null;

            try
            {
                messageStr = message() ?? String.Empty;
            }
            catch (Exception ex)
            {
                messageStr = "[Exception thrown]\n" + ex;
            }

            var formattedMessage = String.Format("{0}{1}{2}",
                                                 traceLevel.AsIndent(), messageStr.Trim(), traceLevel.IsLeaf() ? "" : ":");

            lTraceSink.TraceEvent(formattedMessage);

            Debug.WriteLine(formattedMessage);

            GC.KeepAlive(CurrentState);             // for coverage testing
        }
Esempio n. 2
0
		internal static void TraceEvent(IndentLevel traceLevel, Func<string> message)
		{
			var lTraceSink = DebugView.traceSink;
			if (lTraceSink == null)
				return;

			string messageStr = null;
			try
			{
				messageStr = message() ?? String.Empty;
			}
			catch (Exception ex)
			{
				messageStr = "[Exception thrown]\n" + ex;
			}

			var formattedMessage = String.Join(Environment.NewLine, messageStr.Split('\n')
					.Select(line => String.Format("{0}{1}", traceLevel.AsIndent(), line.TrimEnd())).ToArray())
				+ (traceLevel.IsLeaf() ? "" : ":");
			lTraceSink.TraceEvent(formattedMessage);

			Debug.WriteLine(formattedMessage);

			GC.KeepAlive(CurrentState); // for coverage testing
		}
Esempio n. 3
0
        internal static void TraceEvent(IndentLevel traceLevel, Func <string> message)
        {
            var lTraceSink = DebugView.traceSink;

            if (lTraceSink == null)
            {
                return;
            }

            string messageStr = null;

            try
            {
                messageStr = message() ?? String.Empty;
            }
            catch (Exception ex)
            {
                messageStr = "[Exception thrown]\n" + ex;
            }

            var formattedMessage = String.Join(Environment.NewLine, messageStr.Split('\n')
                                               .Select(line => String.Format("{0}{1}", traceLevel.AsIndent(), line.TrimEnd())).ToArray())
                                   + (traceLevel.IsLeaf() ? "" : ":");

            lTraceSink.TraceEvent(formattedMessage);

            Debug.WriteLine(formattedMessage);

            GC.KeepAlive(CurrentState);             // for coverage testing
        }
Esempio n. 4
0
		internal static void TraceEvent(IndentLevel traceLevel, Func<string> message)
		{
			var lTraceSink = DebugView.traceSink;
			if (lTraceSink == null)
				return;

			string messageStr = null;
			try
			{
				messageStr = message() ?? String.Empty;
			}
			catch (Exception ex)
			{
				messageStr = "[Exception thrown]\n" + ex;
			}

			var formattedMessage = String.Format("{0}{1}{2}",
				traceLevel.AsIndent(), messageStr.Trim(), traceLevel.IsLeaf() ? "" : ":");
			lTraceSink.TraceEvent(formattedMessage);

			Debug.WriteLine(formattedMessage);

			GC.KeepAlive(CurrentState); // for coverage testing
		}