Skip to content

Commit c0a6e71

Browse files
committed
fixed log => logrus
1 parent 38a1278 commit c0a6e71

File tree

13 files changed

+27
-27
lines changed

13 files changed

+27
-27
lines changed

api/client.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"context"
55
"example/util/env"
66
"github.com/grpc-ecosystem/go-grpc-middleware/retry"
7-
log "github.com/sirupsen/logrus"
7+
"github.com/sirupsen/logrus"
88
"google.golang.org/grpc"
99
"google.golang.org/grpc/codes"
1010
"time"
@@ -44,7 +44,7 @@ func HttpAddress() string {
4444
}
4545

4646
func Connect(address string) (*grpc.ClientConn, error) {
47-
log.Infoln("connecting to grpc server...")
47+
logrus.Infoln("connecting to grpc server...")
4848
var err error
4949
opts := []grpc_retry.CallOption{
5050
grpc_retry.WithBackoff(grpc_retry.BackoffExponential(100 * time.Millisecond)),

cmd/example/main.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"example/internal/http"
99
"example/internal/service"
1010
"example/internal/store"
11-
log "github.com/sirupsen/logrus"
11+
"github.com/sirupsen/logrus"
1212
googleGrpc "google.golang.org/grpc"
1313
)
1414

@@ -17,7 +17,7 @@ const ServiceName = "example"
1717
func connectToMongo() connectors.MongoConnector {
1818
mongoConnection := connectors.NewMongoConnection()
1919
if err := mongoConnection.Init(); err != nil {
20-
log.Fatalln(err)
20+
logrus.Fatalln(err)
2121
}
2222
return mongoConnection
2323
}
@@ -42,7 +42,7 @@ func startGrpcServer(shutdown <-chan bool, stores store.Store) grpc.Server {
4242
grpcServer := grpc.NewServer(&opts)
4343
go func() {
4444
if err := grpcServer.Serve(); err != nil {
45-
defer log.Fatalln(err)
45+
defer logrus.Fatalln(err)
4646
<-shutdown
4747
}
4848
}()
@@ -53,7 +53,7 @@ func startHealthCheckServer(shutdown <-chan bool, grpcServer grpc.Server) health
5353
healthCheckServer := healthcheck.NewServer(ServiceName)
5454
go func() {
5555
if err := healthCheckServer.Serve(grpcServer.Instance()); err != nil {
56-
log.Fatalln(err)
56+
logrus.Fatalln(err)
5757
<-shutdown
5858
}
5959
}()
@@ -64,7 +64,7 @@ func startHttpServer(shutdown <-chan bool) http.Server {
6464
httpServer := http.NewServer()
6565
go func() {
6666
if err := httpServer.Serve(); err != nil {
67-
log.Fatalln(err)
67+
logrus.Fatalln(err)
6868
<-shutdown
6969
}
7070
}()

examples/person_grpc/connect.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package person_grpc
22

33
import (
44
"example/api"
5-
example "example/generated"
5+
"example/generated"
66
"github.com/sirupsen/logrus"
77
)
88

examples/person_grpc/create.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package person_grpc
22

33
import (
44
"context"
5-
example "example/generated"
5+
"example/generated"
66
"github.com/sirupsen/logrus"
77
)
88

examples/person_grpc/delete.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package person_grpc
22

33
import (
44
"context"
5-
example "example/generated"
5+
"example/generated"
66
"github.com/sirupsen/logrus"
77
)
88

examples/person_grpc/get.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package person_grpc
33
import (
44
"context"
55
"encoding/json"
6-
example "example/generated"
6+
"example/generated"
77
"github.com/sirupsen/logrus"
88
)
99

examples/person_grpc/list.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package person_grpc
33
import (
44
"context"
55
"encoding/json"
6-
example "example/generated"
6+
"example/generated"
77
"github.com/sirupsen/logrus"
88
)
99

examples/person_grpc/update.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package person_grpc
33
import (
44
"context"
55
"encoding/json"
6-
example "example/generated"
6+
"example/generated"
77
"github.com/sirupsen/logrus"
88
)
99

examples/person_http/delete.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package person_http
22

33
import (
44
"example/api"
5-
example "example/generated"
5+
"example/generated"
66
"fmt"
77
"github.com/go-resty/resty/v2"
88
"github.com/sirupsen/logrus"

internal/connectors/mongo.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"context"
55
"example/util/env"
66
"fmt"
7-
log "github.com/sirupsen/logrus"
7+
"github.com/sirupsen/logrus"
88
"go.mongodb.org/mongo-driver/mongo"
99
"go.mongodb.org/mongo-driver/mongo/options"
1010
"go.mongodb.org/mongo-driver/mongo/readpref"
@@ -43,7 +43,7 @@ func (m *mongoConnector) Init() error {
4343
}
4444

4545
func (m *mongoConnector) Connect(address string, pingTimeout time.Duration) (*mongo.Client, error) {
46-
log.Infoln("connecting to mongo")
46+
logrus.Infoln("connecting to mongo")
4747

4848
counter := 0
4949
ticker := time.NewTicker(1 * time.Second)
@@ -64,7 +64,7 @@ func (m *mongoConnector) Connect(address string, pingTimeout time.Duration) (*mo
6464
if err != nil {
6565
done <- true
6666
fmt.Println()
67-
log.Fatalln("failed to connect to mongo", err)
67+
logrus.Fatalln("failed to connect to mongo", err)
6868
return nil, err
6969
}
7070
ctx, _ := context.WithTimeout(context.Background(), pingTimeout*time.Second)
@@ -76,13 +76,13 @@ func (m *mongoConnector) Connect(address string, pingTimeout time.Duration) (*mo
7676
if err != nil {
7777
done <- true
7878
fmt.Println()
79-
log.Fatalln("mongo health check failed", err)
79+
logrus.Fatalln("mongo health check failed", err)
8080
return nil, err
8181
}
8282

8383
done <- true
8484
fmt.Println()
85-
log.Infoln("connected to mongo")
85+
logrus.Infoln("connected to mongo")
8686

8787
return client, nil
8888
}

0 commit comments

Comments
 (0)