mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Add *log flag for logging ees events
This commit is contained in:
committed by
Dan Christian Bogos
parent
c4fefedefa
commit
9e2a629b82
@@ -600,7 +600,7 @@ const CGRATES_CFG_JSON = `
|
||||
}, // extra options for exporter
|
||||
"timezone": "", // timezone for timestamps where not specified <""|UTC|Local|$IANA_TZ_DB>
|
||||
"filters": [], // limit parsing based on the filters
|
||||
"flags": [], // flags to influence the event processing
|
||||
"flags": [], // flags to influence the event processing <*attributes|*log>
|
||||
"attribute_ids": [], // select Attribute profiles instead of discovering them
|
||||
"attribute_context": "", // context used to discover matching Attribute profiles
|
||||
"synchronous": false, // block processing until export has a result
|
||||
|
||||
23
ees/ees.go
23
ees/ees.go
@@ -320,6 +320,29 @@ func ExportWithAttempts(exp EventExporter, eEv any, key string) (err error) {
|
||||
utils.EEs, exp.Cfg().ID, err.Error()))
|
||||
return
|
||||
}
|
||||
|
||||
if exp.Cfg().Flags.GetBool(utils.MetaLog) {
|
||||
var evLog string
|
||||
switch c := eEv.(type) {
|
||||
case []byte:
|
||||
evLog = string(c)
|
||||
case string:
|
||||
evLog = c
|
||||
case *HTTPPosterRequest:
|
||||
evByt, cancast := c.Body.([]byte)
|
||||
if cancast {
|
||||
evLog = string(evByt)
|
||||
break
|
||||
}
|
||||
evLog = utils.ToJSON(c.Body)
|
||||
default:
|
||||
evLog = utils.ToJSON(c)
|
||||
}
|
||||
utils.Logger.Info(
|
||||
fmt.Sprintf("<%s> LOG, exporter <%s>, message: %s",
|
||||
utils.EEs, exp.Cfg().ID, evLog))
|
||||
}
|
||||
|
||||
for i := 0; i < exp.Cfg().Attempts; i++ {
|
||||
if err = exp.ExportEvent(eEv, key); err == nil ||
|
||||
err == utils.ErrDisconnected { // special error in case the exporter was closed
|
||||
|
||||
Reference in New Issue
Block a user