Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: delete redundant logs #36

Merged
merged 1 commit into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -433,10 +429,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 @@ -471,7 +465,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 @@ -496,7 +489,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 @@ -520,7 +512,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 @@ -540,7 +531,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