better loging

This commit is contained in:
Radu Ioan Fericean
2012-10-10 11:49:53 +03:00
parent 9a89bc981d
commit db08f7e146
3 changed files with 5 additions and 5 deletions

View File

@@ -197,7 +197,7 @@ func (at *ActionTiming) getUserBalances() (ubs []*UserBalance) {
for _, ubId := range at.UserBalanceIds {
ub, err := storageGetter.GetUserBalance(ubId)
if err != nil {
Logger.Warning(fmt.Sprintf("Could not get user balances for therse id: %v. Skipping!", ubId))
Logger.Warning(fmt.Sprintf("Could not get user balances for therse id: %s. Skipping!", ubId))
}
ubs = append(ubs, ub)
}

View File

@@ -95,8 +95,8 @@ func (sm *FSSessionManager) GetSession(uuid string) *Session {
// Disconnects a session by sending hangup command to freeswitch
func (sm *FSSessionManager) DisconnectSession(s *Session, notify string) {
rater.Logger.Debug(fmt.Sprintf("Session: %+v", s))
err := fsock.SendApiCmd(fmt.Sprintf("api uuid_setvar %s cgr_notify %s\n\n", s.uuid, notify))
rater.Logger.Debug(fmt.Sprintf("Session: %+v", s.uuid))
err := fsock.SendApiCmd(fmt.Sprintf("uuid_setvar %s cgr_notify %s\n\n", s.uuid, notify))
if err != nil {
rater.Logger.Err("could not send disconect api notification to freeswitch")
}
@@ -171,7 +171,6 @@ func (sm *FSSessionManager) OnChannelAnswer(ev Event) {
if s != nil {
sm.sessions = append(sm.sessions, s)
}
rater.Logger.Debug(fmt.Sprintf("sessions: %v", sm.sessions))
}
func (sm *FSSessionManager) OnChannelHangupComplete(ev Event) {
@@ -280,6 +279,7 @@ func (sm *FSSessionManager) OnChannelHangupComplete(ev Event) {
}
lastCC.Cost -= cost
rater.Logger.Info(fmt.Sprintf("Rambursed %v cents, %v seconds", cost, seconds))
s.SaveOperations()
}
func (sm *FSSessionManager) LoopAction(s *Session, cd *rater.CallDescriptor) {
@@ -313,7 +313,6 @@ func (sm *FSSessionManager) GetDbLogger() rater.DataStorage {
func (sm *FSSessionManager) Shutdown() (err error) {
rater.Logger.Info("Shutting down all sessions...")
rater.Logger.Debug(fmt.Sprintf("sessions: %v", sm.sessions))
for _, s := range sm.sessions {
sm.DisconnectSession(s, MANAGER_REQUEST)
}

View File

@@ -107,6 +107,7 @@ func (s *Session) GetSessionDuration() time.Duration {
// Stops the debit loop
func (s *Session) Close() {
rater.Logger.Debug(fmt.Sprintf("Stopping debit for %s", s.uuid))
if s == nil {
return
}