示例#1
0
        public void WriteClientActivity(ClientActivity activity)
        {
            if (_writer != null && activity != null)
            {
                TimeSpan tspan = activity.EndTime - activity.StartTime;

                WriteSingleLine("activity [duration(ms) :" + tspan.TotalMilliseconds + " start_time :" + activity.StartTime.ToString(TIME_FORMAT) + " end_time :" + activity.EndTime.ToString(TIME_FORMAT) + "]");

                if (activity.Activities != null)
                {
                    for (int i = 0; i < activity.Activities.Count; i++)
                    {
                        MethodActivity mActivity = activity.Activities[i] as MethodActivity;
                        if (mActivity != null)
                        {
                            int    space2 = 40;
                            string line   = null;
                            line = mActivity.Time.ToString(TIME_FORMAT) + ":  " + mActivity.MethodName.PadRight(space2, ' ') + mActivity.Log;
                            lock (_sync_mutex)
                            {
                                _writer.WriteLine(line);
                                _writer.Flush();
                            }
                        }
                    }
                }
                WriteSingleLine("activity ends");
                WriteSingleLine("");
            }
        }
示例#2
0
 public void LogActivity(string method, string log)
 {
     MethodActivity mActivity = new MethodActivity(method, log);
     lock (this)
     {
         _activities.Add(mActivity);
     }
 }
示例#3
0
        public void LogActivity(string method, string log)
        {
            MethodActivity mActivity = new MethodActivity(method, log);

            lock (this)
            {
                _activities.Add(mActivity);
            }
        }