mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Add log action for radius and http agent
This commit is contained in:
committed by
Dan Christian Bogos
parent
9600ab9a27
commit
b60673794e
@@ -115,6 +115,11 @@ func (ha *HTTPAgent) processRequest(reqProcessor *config.HttpAgntProcCfg,
|
||||
break
|
||||
}
|
||||
}
|
||||
if reqProcessor.Flags.HasKey(utils.MetaLog) {
|
||||
utils.Logger.Info(
|
||||
fmt.Sprintf("<%s> LOG, processorID: %s, diameter message: %s",
|
||||
utils.HTTPAgent, reqProcessor.ID, agReq.Request.String()))
|
||||
}
|
||||
switch reqType {
|
||||
default:
|
||||
return false, fmt.Errorf("unknown request type: <%s>", reqType)
|
||||
@@ -209,6 +214,11 @@ func (ha *HTTPAgent) processRequest(reqProcessor *config.HttpAgntProcCfg,
|
||||
} else {
|
||||
agReq.Reply.Merge(nM)
|
||||
}
|
||||
if reqProcessor.Flags.HasKey(utils.MetaLog) {
|
||||
utils.Logger.Info(
|
||||
fmt.Sprintf("<%s> LOG, HTTP reply: %s",
|
||||
utils.HTTPAgent, agReq.Reply))
|
||||
}
|
||||
if reqType == utils.MetaDryRun {
|
||||
utils.Logger.Info(
|
||||
fmt.Sprintf("<%s> DRY_RUN, HTTP reply: %s",
|
||||
|
||||
@@ -60,8 +60,7 @@ type httpUrlDP struct {
|
||||
// String is part of engine.DataProvider interface
|
||||
// when called, it will display the already parsed values out of cache
|
||||
func (hU *httpUrlDP) String() string {
|
||||
//return utils.ToJSON(hU.cache.AsMapStringInterface())
|
||||
return "" // ToDo: fixme
|
||||
return hU.cache.String()
|
||||
}
|
||||
|
||||
// FieldAsInterface is part of engine.DataProvider interface
|
||||
@@ -123,8 +122,7 @@ type httpXmlDP struct {
|
||||
// String is part of engine.DataProvider interface
|
||||
// when called, it will display the already parsed values out of cache
|
||||
func (hU *httpXmlDP) String() string {
|
||||
//return utils.ToJSON(hU.cache.AsMapStringInterface())
|
||||
return "" // ToDo: fixme
|
||||
return hU.cache.String()
|
||||
}
|
||||
|
||||
// FieldAsInterface is part of engine.DataProvider interface
|
||||
|
||||
@@ -150,7 +150,7 @@ type radiusDP struct {
|
||||
// String is part of engine.DataProvider interface
|
||||
// when called, it will display the already parsed values out of cache
|
||||
func (pk *radiusDP) String() string {
|
||||
return utils.ToJSON(pk.cache)
|
||||
return pk.cache.String()
|
||||
}
|
||||
|
||||
// FieldAsInterface is part of engine.DataProvider interface
|
||||
|
||||
@@ -172,6 +172,11 @@ func (ra *RadiusAgent) processRequest(reqProcessor *config.RARequestProcessor,
|
||||
break
|
||||
}
|
||||
}
|
||||
if reqProcessor.Flags.HasKey(utils.MetaLog) {
|
||||
utils.Logger.Info(
|
||||
fmt.Sprintf("<%s> LOG, processorID: %s, diameter message: %s",
|
||||
utils.RadiusAgent, reqProcessor.ID, agReq.Request.String()))
|
||||
}
|
||||
switch reqType {
|
||||
default:
|
||||
return false, fmt.Errorf("unknown request type: <%s>", reqType)
|
||||
@@ -268,6 +273,11 @@ func (ra *RadiusAgent) processRequest(reqProcessor *config.RARequestProcessor,
|
||||
if err := radReplyAppendAttributes(rply, agReq, reqProcessor.ReplyFields); err != nil {
|
||||
return false, err
|
||||
}
|
||||
if reqProcessor.Flags.HasKey(utils.MetaLog) {
|
||||
utils.Logger.Info(
|
||||
fmt.Sprintf("<%s> LOG, Radius reply: %s",
|
||||
utils.RadiusAgent, utils.ToJSON(rply)))
|
||||
}
|
||||
if reqType == utils.MetaDryRun {
|
||||
utils.Logger.Info(
|
||||
fmt.Sprintf("<%s> DRY_RUN, Radius reply: %s",
|
||||
|
||||
Reference in New Issue
Block a user