/// <summary> /// Creates an activity and links the current point in the Tracing with this activity /// use this if you start an async process so you can jump right to this activity /// </summary> /// <param name="calling"> /// The calling assembly. /// </param> /// <param name="switchInfo"> /// The switch Info. /// </param> private static TraceActivity CreateAndLinkActivity(Assembly calling, string switchInfo) { var localTrace = GetTraceSourceFromAssembly(calling); var activity = new TraceActivity(CreateActivity(), switchInfo); SwitchToActivity(activity.Activity, activity.SwitchInfo, localTrace); return(activity); }
/// <summary> /// Traces an async activity from start to finish, you get a TraceActivity object from CreateAndLinkActivity /// </summary> /// <param name="activity"> /// The activity you want to trace. /// </param> /// <example> /// <![CDATA[ /// using(Logger.TraceActivity(myActivity)) /// { /// // Do my async action here /// } /// ]]> /// </example> /// <returns> /// an object designed to be used in an using statement /// </returns> public static IDisposable TraceActivity(TraceActivity activity) { #if TRACE var calling = Assembly.GetCallingAssembly(); return(TraceActivity(calling, activity.Activity, activity.SwitchInfo)); #else return(null); #endif }
/// <summary> /// The equals. /// </summary> /// <param name="other"> /// The other. /// </param> /// <returns> /// The equals. /// </returns> public bool Equals(TraceActivity other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(other.Activity.Equals(this.Activity)); }
/// <summary> /// The equals. /// </summary> /// <param name="other"> /// The other. /// </param> /// <returns> /// The equals. /// </returns> public bool Equals(TraceActivity other) { if (ReferenceEquals(null, other)) { return false; } if (ReferenceEquals(this, other)) { return true; } return other.Activity.Equals(this.Activity); }
/// <summary> /// Creates an activity and links the current point in the Tracing with this activity /// use this if you start an async process so you can jump right to this activity /// </summary> /// <param name="calling"> /// The calling assembly. /// </param> /// <param name="switchInfo"> /// The switch Info. /// </param> private static TraceActivity CreateAndLinkActivity(Assembly calling, string switchInfo) { var localTrace = GetTraceSourceFromAssembly(calling); var activity = new TraceActivity(CreateActivity(), switchInfo); SwitchToActivity(activity.Activity, activity.SwitchInfo, localTrace); return activity; }
/// <summary> /// Traces an async activity from start to finish, you get a TraceActivity object from CreateAndLinkActivity /// </summary> /// <param name="activity"> /// The activity you want to trace. /// </param> /// <example> /// <![CDATA[ /// using(Logger.TraceActivity(myActivity)) /// { /// // Do my async action here /// } /// ]]> /// </example> /// <returns> /// an object designed to be used in an using statement /// </returns> public static IDisposable TraceActivity(TraceActivity activity) { #if TRACE var calling = Assembly.GetCallingAssembly(); return TraceActivity(calling, activity.Activity, activity.SwitchInfo); #else return null; #endif }