Remove fmt.Prinln and add Zerolog logging system
All checks were successful
Build and Push Docker Image / build_and_push (push) Successful in 1m51s
All checks were successful
Build and Push Docker Image / build_and_push (push) Successful in 1m51s
This commit is contained in:
@@ -2,8 +2,8 @@ package storage
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/spf13/viper"
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
"go.mongodb.org/mongo-driver/mongo/options"
|
||||
@@ -77,15 +77,13 @@ func (s MongoDBStorage) GetEvents(namespaces []string) (events []Event, err erro
|
||||
if len(namespaces) == 0 {
|
||||
cur, err = collection.Find(context.TODO(), bson.D{}, findOptions)
|
||||
if err != nil {
|
||||
fmt.Println("...")
|
||||
fmt.Println(err)
|
||||
log.Error().Err(err).Msg("")
|
||||
return events, err
|
||||
}
|
||||
} else {
|
||||
cur, err = collection.Find(context.TODO(), bson.M{"namespace": bson.M{"$in": namespaces}}, findOptions)
|
||||
if err != nil {
|
||||
fmt.Println("Error here")
|
||||
fmt.Println(err)
|
||||
log.Error().Err(err).Msg("")
|
||||
return events, err
|
||||
}
|
||||
}
|
||||
@@ -98,12 +96,6 @@ func (s MongoDBStorage) GetEvents(namespaces []string) (events []Event, err erro
|
||||
return events, err
|
||||
}
|
||||
|
||||
// fmt.Println(elem)
|
||||
|
||||
// bsonBytes, _ := bson.Marshal(elem)
|
||||
// fmt.Println(string(bsonBytes))
|
||||
// bson.Unmarshal(bsonBytes, &event)
|
||||
|
||||
events = append(events, event)
|
||||
|
||||
}
|
||||
@@ -147,7 +139,7 @@ func (s MongoDBStorage) UpdateSubscription(eventid string, subscriber string, de
|
||||
func (s MongoDBStorage) UpdateEvent(event Event) error {
|
||||
collection := s.Client.Database(s.DbName).Collection(s.Collections["events"])
|
||||
if _, err := collection.ReplaceOne(context.TODO(), bson.M{"_id": event.ID}, event); err != nil {
|
||||
fmt.Println(err)
|
||||
log.Error().Err(err).Msg("")
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user