From fc4696cdaf05882f0ea98c0f9f110a65aa26b151 Mon Sep 17 00:00:00 2001 From: DanB Date: Thu, 28 Nov 2013 18:15:48 +0100 Subject: [PATCH] Some more debug messages removal --- engine/calldesc.go | 14 +++++++------- engine/loader_db.go | 14 +++++++------- engine/timespans.go | 12 ++++++------ 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/engine/calldesc.go b/engine/calldesc.go index 5a46a6739..ecc46bc25 100644 --- a/engine/calldesc.go +++ b/engine/calldesc.go @@ -332,7 +332,7 @@ func (cd *CallDescriptor) splitInTimeSpans(firstSpan *TimeSpan) (timespans []*Ti } } } - Logger.Debug(fmt.Sprintf("After SplitByRateInterval: %+v", timespans)) + //Logger.Debug(fmt.Sprintf("After SplitByRateInterval: %+v", timespans)) //log.Printf("After SplitByRateInterval: %+v", timespans) timespans = cd.roundTimeSpansToIncrement(timespans) // Logger.Debug(fmt.Sprintf("After round: %+v", timespans)) @@ -437,13 +437,13 @@ func (cd *CallDescriptor) GetMaxSessionTime(startTime time.Time) (seconds float6 return 0, err } availableCredit, availableSeconds := 0.0, 0.0 - Logger.Debug(fmt.Sprintf("cd: %+v", cd)) + // Logger.Debug(fmt.Sprintf("cd: %+v", cd)) if userBalance, err := cd.getUserBalance(); err == nil && userBalance != nil { if userBalance.Type == UB_TYPE_POSTPAID { return -1, nil } else { availableSeconds, availableCredit, _ = userBalance.getSecondsForPrefix(cd) - Logger.Debug(fmt.Sprintf("available sec: %v credit: %v", availableSeconds, availableCredit)) + // Logger.Debug(fmt.Sprintf("available sec: %v credit: %v", availableSeconds, availableCredit)) } } else { Logger.Err(fmt.Sprintf("Could not get user balance for %s: %s.", cd.GetUserBalanceKey(), err.Error())) @@ -475,7 +475,7 @@ func (cd *CallDescriptor) GetMaxSessionTime(startTime time.Time) (seconds float6 maxSessionSeconds -= cd.Amount * 0.1 } } - Logger.Debug("Even 10% of the max session time is too much!") + // Logger.Debug("Even 10% of the max session time is too much!") return 0, nil } @@ -490,9 +490,9 @@ func (cd *CallDescriptor) Debit() (cc *CallCost, err error) { if userBalance, err := cd.getUserBalance(); err != nil { Logger.Err(fmt.Sprintf(" Error retrieving user balance: %v", err)) } else if userBalance == nil { - Logger.Debug(fmt.Sprintf(" No user balance defined: %v", cd.GetUserBalanceKey())) + // Logger.Debug(fmt.Sprintf(" No user balance defined: %v", cd.GetUserBalanceKey())) } else { - Logger.Debug(fmt.Sprintf(" Attempting to debit from %v, value: %v", cd.GetUserBalanceKey(), cc.Cost+cc.ConnectFee)) + // Logger.Debug(fmt.Sprintf(" Attempting to debit from %v, value: %v", cd.GetUserBalanceKey(), cc.Cost+cc.ConnectFee)) defer storageGetter.SetUserBalance(userBalance) if cc.Cost != 0 || cc.ConnectFee != 0 { userBalance.debitCreditBalance(cc, true) @@ -507,7 +507,7 @@ func (cd *CallDescriptor) Debit() (cc *CallCost, err error) { // by the GetMaxSessionTime method. The amount filed has to be filled in call descriptor. func (cd *CallDescriptor) MaxDebit(startTime time.Time) (cc *CallCost, err error) { remainingSeconds, err := cd.GetMaxSessionTime(startTime) - Logger.Debug(fmt.Sprintf("In MaxDebitd remaining seconds: %v", remainingSeconds)) + // Logger.Debug(fmt.Sprintf("In MaxDebitd remaining seconds: %v", remainingSeconds)) if err != nil || remainingSeconds == 0 { return new(CallCost), errors.New("no more credit") } diff --git a/engine/loader_db.go b/engine/loader_db.go index 97474152e..cf7bacd6a 100644 --- a/engine/loader_db.go +++ b/engine/loader_db.go @@ -252,9 +252,9 @@ func (dbr *DbReader) LoadRatingPlanByTag(tag string) (bool, error) { for tag, rplBnds := range mpRpls { ratingPlan := &RatingPlan{Id: tag} for _, rp := range rplBnds { - Logger.Debug(fmt.Sprintf("Rating Plan binding: %v", rp)) + // Logger.Debug(fmt.Sprintf("Rating Plan binding: %v", rp)) tm, err := dbr.storDb.GetTpTimings(dbr.tpid, rp.TimingId) - Logger.Debug(fmt.Sprintf("Timing: %v", tm)) + // Logger.Debug(fmt.Sprintf("Timing: %v", tm)) if err != nil || len(tm) == 0 { return false, fmt.Errorf("No Timings profile with id %s: %v", rp.TimingId, err) } @@ -264,12 +264,12 @@ func (dbr *DbReader) LoadRatingPlanByTag(tag string) (bool, error) { return false, fmt.Errorf("No DestinationRates profile with id %s: %v", rp.DestinationRatesId, err) } for _, drate := range drm[rp.DestinationRatesId].DestinationRates { - Logger.Debug(fmt.Sprintf("Destination rate: %v", drate)) + // Logger.Debug(fmt.Sprintf("Destination rate: %v", drate)) rt, err := dbr.storDb.GetTpRates(dbr.tpid, drate.RateId) if err != nil || len(rt) == 0 { return false, fmt.Errorf("No Rates profile with id %s: %v", drate.RateId, err) } - Logger.Debug(fmt.Sprintf("Rate: %v", rt)) + // Logger.Debug(fmt.Sprintf("Rate: %v", rt)) drate.Rate = rt[drate.RateId] ratingPlan.AddRateInterval(drate.DestinationId, GetRateInterval(rp, drate)) @@ -284,9 +284,9 @@ func (dbr *DbReader) LoadRatingPlanByTag(tag string) (bool, error) { } continue } - Logger.Debug(fmt.Sprintf("Tag: %s Destinations: %v", drate.DestinationId, dms)) + // Logger.Debug(fmt.Sprintf("Tag: %s Destinations: %v", drate.DestinationId, dms)) for _, destination := range dms { - Logger.Debug(fmt.Sprintf("Destination: %v", destination)) + // Logger.Debug(fmt.Sprintf("Destination: %v", destination)) dbr.dataDb.SetDestination(destination) } } @@ -305,7 +305,7 @@ func (dbr *DbReader) LoadRatingProfileFiltered(qriedRpf *utils.TPRatingProfile) return fmt.Errorf("No RateProfile for filter %v, error: %s", qriedRpf, err.Error()) } for _, tpRpf := range mpTpRpfs { - Logger.Debug(fmt.Sprintf("Rating profile: %v", tpRpf)) + // Logger.Debug(fmt.Sprintf("Rating profile: %v", tpRpf)) resultRatingProfile = &RatingProfile{Id: tpRpf.KeyId()} for _, tpRa := range tpRpf.RatingPlanActivations { at, err := utils.ParseDate(tpRa.ActivationTime) diff --git a/engine/timespans.go b/engine/timespans.go index f1e5a30fc..1984e191d 100644 --- a/engine/timespans.go +++ b/engine/timespans.go @@ -19,7 +19,7 @@ along with this program. If not, see package engine import ( - "fmt" + //"fmt" "github.com/cgrates/cgrates/utils" "time" ) @@ -149,7 +149,7 @@ func (ts *TimeSpan) SplitByRateInterval(i *RateInterval) (nts *TimeSpan) { for _, rate := range i.Rating.Rates { // Logger.Debug(fmt.Sprintf("Rate: %+v", rate)) if ts.GetGroupStart() < rate.GroupIntervalStart && ts.GetGroupEnd() > rate.GroupIntervalStart { - Logger.Debug(fmt.Sprintf("Splitting")) + // Logger.Debug(fmt.Sprintf("Splitting")) ts.SetRateInterval(i) splitTime := ts.TimeStart.Add(rate.GroupIntervalStart - ts.GetGroupStart()) //log.Print("SPLIT: ", splitTime) @@ -162,7 +162,7 @@ func (ts *TimeSpan) SplitByRateInterval(i *RateInterval) (nts *TimeSpan) { nts.SetRateInterval(i) nts.CallDuration = ts.CallDuration ts.SetNewCallDuration(nts) - Logger.Debug(fmt.Sprintf("Group splitting: %+v %+v", ts, nts)) + // Logger.Debug(fmt.Sprintf("Group splitting: %+v %+v", ts, nts)) //log.Printf("Group splitting: %+v %+v", ts, nts) return } @@ -192,7 +192,7 @@ func (ts *TimeSpan) SplitByRateInterval(i *RateInterval) (nts *TimeSpan) { ts.TimeEnd = splitTime nts.CallDuration = ts.CallDuration ts.SetNewCallDuration(nts) - Logger.Debug(fmt.Sprintf("right: %+v %+v", ts, nts)) + // Logger.Debug(fmt.Sprintf("right: %+v %+v", ts, nts)) //log.Printf("right: %+v %+v", ts, nts) return } @@ -215,7 +215,7 @@ func (ts *TimeSpan) SplitByRateInterval(i *RateInterval) (nts *TimeSpan) { nts.SetRateInterval(i) nts.CallDuration = ts.CallDuration ts.SetNewCallDuration(nts) - Logger.Debug(fmt.Sprintf("left: %+v %+v", ts, nts)) + // Logger.Debug(fmt.Sprintf("left: %+v %+v", ts, nts)) //log.Printf("left: %+v %+v", ts, nts) return } @@ -290,7 +290,7 @@ func (ts *TimeSpan) SplitByRatingPlan(rp *RatingInfo) (newTs *TimeSpan) { newTs.CallDuration = ts.CallDuration ts.TimeEnd = rp.ActivationTime ts.SetNewCallDuration(newTs) - Logger.Debug(fmt.Sprintf("RP SPLITTING: %+v %+v", ts, newTs)) + // Logger.Debug(fmt.Sprintf("RP SPLITTING: %+v %+v", ts, newTs)) //log.Printf("RP SPLITTING: %+v %+v", ts, newTs) return }