mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-12 02:26:26 +05:00
better loging
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user