Skip to content

Commit

Permalink
Logging configure
Browse files Browse the repository at this point in the history
  • Loading branch information
Guilherme Souza committed Sep 25, 2017
1 parent d0157a9 commit 7861e9e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
7 changes: 7 additions & 0 deletions pusher/apns.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ func (a *APNSPusher) loadConfigurationDefaults() {

func (a *APNSPusher) configure(queue interfaces.APNSPushQueue, db interfaces.DB, statsdClientOrNil interfaces.StatsDClient) error {
var err error
l := a.Logger.WithFields(logrus.Fields{
"method": "configure",
})
a.loadConfigurationDefaults()
a.GracefulShutdownTimeout = a.Config.GetInt("gracefulShutdownTimeout")
if err = a.configureStatsReporters(statsdClientOrNil); err != nil {
Expand All @@ -106,6 +109,10 @@ func (a *APNSPusher) configure(queue interfaces.APNSPushQueue, db interfaces.DB,
a.Queue = q

for k, v := range a.Config.GetStringMap("apns.games") {
l.Infof(
"Configuring messageHandler for game %s with certificate: %s",
k, v,
)
handler, err := extensions.NewAPNSMessageHandler(
v.(string),
a.IsProduction,
Expand Down
13 changes: 11 additions & 2 deletions pusher/gcm.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ func (g *GCMPusher) loadConfigurationDefaults() {

func (g *GCMPusher) configure(client interfaces.GCMClient, db interfaces.DB, statsdClientOrNil interfaces.StatsDClient) error {
var err error
l := g.Logger.WithFields(logrus.Fields{
"method": "configure",
})
g.loadConfigurationDefaults()
g.GracefulShutdownTimeout = g.Config.GetInt("gracefulShutdownTimeout")
if err = g.configureStatsReporters(statsdClientOrNil); err != nil {
Expand All @@ -111,9 +114,15 @@ func (g *GCMPusher) configure(client interfaces.GCMClient, db interfaces.DB, sta
g.Queue = q
g.MessageHandler = make(map[string]interfaces.MessageHandler)
for k := range g.Config.GetStringMap("gcm.games") {
senderID := g.Config.GetString("gcm.certs." + k + ".senderID")
apiKey := g.Config.GetString("gcm.certs." + k + ".apiKey")
l.Infof(
"Configuring messageHandler for game %s with senderID %s and apiKey %s",
k, senderID, apiKey,
)
handler, herr := extensions.NewGCMMessageHandler(
g.Config.GetString("gcm.certs."+k+".senderID"),
g.Config.GetString("gcm.certs."+k+".apiKey"),
senderID,
apiKey,
g.IsProduction,
g.Config,
g.Logger,
Expand Down

0 comments on commit 7861e9e

Please sign in to comment.