Skip to content

Commit

Permalink
Merge pull request #36 from ambrosus/delete-logs
Browse files Browse the repository at this point in the history
feat: delete redundant logs
  • Loading branch information
serezhaolshan authored Nov 29, 2023
2 parents e54fa58 + 6083ead commit 8c00b3a
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 14 deletions.
2 changes: 0 additions & 2 deletions services/watcher/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package watcher
import (
"errors"
"net/url"
"fmt"

"github.com/gofiber/fiber/v2"
)
Expand Down Expand Up @@ -50,7 +49,6 @@ func (h *Handler) GetWatcherHandler(c *fiber.Ctx) error {
return c.Status(fiber.StatusBadRequest).JSON(fiber.Map{"error": err.Error()})
}

fmt.Printf("GetWatcherHandler -> watcher: %+v\n", watcher)

return c.JSON(watcher)
}
Expand Down
2 changes: 0 additions & 2 deletions services/watcher/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package watcher
import (
"context"
"errors"
"fmt"

"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo"
Expand Down Expand Up @@ -83,7 +82,6 @@ func (r *repository) GetWatcherList(ctx context.Context, filters bson.M, page in
watchers = append(watchers, &watcher)
}

fmt.Printf("GetWatcherList -> watchers: %v\n", watchers)

// Check for any errors that occurred during iteration
if err := cur.Err(); err != nil {
Expand Down
10 changes: 0 additions & 10 deletions services/watcher/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,6 @@ func (s *service) PriceWatch(ctx context.Context, watcherId string, stopChan cha
body := fmt.Sprintf("🚀 AMB Price changed on +%v%s! Current price $%v\n", roundedPercentage, "%", roundedPrice)
sent := false

fmt.Printf("Title: %s, Body: %s, Token: %s, Data: %+v\n", title, body, string(decodedPushToken), data)
response, err := s.cloudMessagingSvc.SendMessage(ctx, title, body, string(decodedPushToken), data)
if err != nil {
s.logger.Errorf("PriceWatch (Up) cloudMessagingSvc.SendMessage error %v\n", err)
Expand Down Expand Up @@ -323,7 +322,6 @@ func (s *service) PriceWatch(ctx context.Context, watcherId string, stopChan cha
body := fmt.Sprintf("🔻 AMB Price changed on -%v%s! Current price $%v\n", roundedPercentage, "%", roundedPrice)
sent := false

fmt.Printf("Title: %s, Body: %s, Token: %s, Data: %+v\n", title, body, string(decodedPushToken), data)
response, err := s.cloudMessagingSvc.SendMessage(ctx, title, body, string(decodedPushToken), data)
if err != nil {
s.logger.Errorf("PriceWatch (Down) cloudMessagingSvc.SendMessage error %v\n", err)
Expand All @@ -336,7 +334,6 @@ func (s *service) PriceWatch(ctx context.Context, watcherId string, stopChan cha
sent = true
}

fmt.Printf("AddNotification, PriceWatch: title: %v, body: %v, sent: %t, time: %v\n", title, body, sent, time.Now())
watcher.AddNotification(title, body, sent, time.Now())
}

Expand Down Expand Up @@ -417,7 +414,6 @@ func (s *service) TransactionWatch(ctx context.Context, address string, txHash s
body := fmt.Sprintf("From: %s\nTo: %s\nAmount: %s %s", cutFromAddress, cutToAddress, roundedAmount, tokenSymbol)
sent := false

fmt.Printf("Title: %s, Body: %s, Token: %s, Data: %+v\n", title, body, string(decodedPushToken), data)
response, err := s.cloudMessagingSvc.SendMessage(ctx, title, body, string(decodedPushToken), data)
if err != nil {
s.logger.Errorf("TransactionWatch cloudMessagingSvc.SendMessage error %v\n", err)
Expand All @@ -432,10 +428,8 @@ func (s *service) TransactionWatch(ctx context.Context, address string, txHash s
sent = true
}

fmt.Printf("AddNotification, TransactionWatch: title: %v, body: %v, sent: %t, time: %v\n", title, body, sent, time.Now())
watcher.AddNotification(title, body, sent, time.Now())

fmt.Printf("Tx notify: %v:%v\n", txHash, watcher.PushToken)
cache[itemId] = true
}

Expand Down Expand Up @@ -470,7 +464,6 @@ func (s *service) GetWatcher(ctx context.Context, pushToken string) (*Watcher, e
return nil, errors.New("watcher not found")
}

fmt.Printf("GetWatcher -> watcher %v\n", watcher)

s.mx.Lock()
s.cachedWatcher[encodePushToken] = watcher
Expand All @@ -495,7 +488,6 @@ func (s *service) CreateWatcher(ctx context.Context, pushToken string) error {
return errors.New("watcher for this address and token already exist")
}

fmt.Printf("GetWatcherHistoryPrices -> dbWatcher %v\n", dbWatcher)

watcher, err := NewWatcher(encodePushToken)
if err != nil {
Expand All @@ -519,7 +511,6 @@ func (s *service) CreateWatcher(ctx context.Context, pushToken string) error {
return err
}

fmt.Printf("GetWatcherHistoryPrices -> watcher after repository create %v\n", dbWatcher)

s.mx.Lock()
s.cachedWatcher[watcher.PushToken] = watcher
Expand All @@ -539,7 +530,6 @@ func (s *service) UpdateWatcher(ctx context.Context, pushToken string, addresses
return errors.New("watcher not found")
}

fmt.Printf("UpdateWatcher(%v, %v, %v, %v, %v)\n", pushToken, addresses, threshold, txNotification, priceNotification)

if addresses != nil && len(*addresses) > 0 {
var req bytes.Buffer
Expand Down

0 comments on commit 8c00b3a

Please sign in to comment.