private void CompleteTransaction(Transaction root) { root.Depth--; var depth = root.Depth; if (depth == 0) { #region 时间间隔(毫秒计算) root.TimeSpanInMilliseconds = MilliSecondTimer.TimeSpanInMilliseconds(root.Time, MilliSecondTimer.CurrentTime()); #endregion return; } // var countE = root.Evens.Count; if (countE == 0) { return; } var rootEven = root.Evens[countE - 1]; var countT = rootEven.Transactions.Count; if (countT == 0) { return; } var currentT = rootEven.Transactions[countT - 1]; CompleteTransaction(currentT); }
/// <summary> /// 创建事务 /// </summary> /// <param name="type">事务的类型</param> /// <param name="category">事务的分类</param> /// <param name="name">事务名称</param> public Transaction(string type, string category, string name) { // TODO: Complete member initialization this.Type = type; this.Category = category; this.Name = name; this.Time = MilliSecondTimer.CurrentTime(); }
/// <summary> /// 创建事件 /// </summary> /// <param name="name">事件名称</param> /// <param name="description">事件描述</param> public Even(string name, string description) { // TODO: Complete member initialization this.Name = name; this.Description = description; this.IsException = false; this.Time = MilliSecondTimer.CurrentTime(); }
public Context() { this.IsException = false; this.BeginTime = MilliSecondTimer.CurrentTime(); this.Guid = System.Guid.NewGuid().ToString(); this.Project = ConfigInfoHelper.Instance.Info.Project; this.ProjectCode = ConfigInfoHelper.Instance.Info.ProjectCode; this.LocalHostName = NetworkInterfaceManager.LocalHostName; this.LocalHostAddress = NetworkInterfaceManager.LocalHostAddress; }
/// <summary> /// 业务事务-完成 /// 访问属性-public=>private /// </summary> private void Complete() { var ctx = _manager.GetContext(); CompleteTransaction(ctx.Transaction); if (ctx.Transaction.Depth == 0) { ctx.EndTime = MilliSecondTimer.CurrentTime(); #region 时间间隔(毫秒计算) ctx.TimeSpanInMilliseconds = MilliSecondTimer.TimeSpanInMilliseconds(ctx.BeginTime, ctx.EndTime); #endregion var log = MessagePrint.PlainTextMessage(ctx); //LOG Exception LogHelper.Instance.Info(log); //Logger.Info(log); // ctx.Transaction = null; // _manager.Dispose(); } }