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

Fix: Missing Connection Successful Logs #1206

Merged
merged 36 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
c66c110
added missing connection logs
coolwednesday Nov 15, 2024
6b4db8b
Merge branch 'gofr-dev:development' into missing-logs
coolwednesday Nov 15, 2024
ad0d1e1
modifying logs
coolwednesday Nov 15, 2024
e8af568
adding mocks previously removed from build
coolwednesday Nov 15, 2024
a11736e
add kafka metrics mocks in build
coolwednesday Nov 15, 2024
65e3ac9
remove build exclude from file mocks
coolwednesday Nov 17, 2024
4dd2c12
Merge branch 'development' into missing-logs
coolwednesday Nov 17, 2024
bb023e9
Merge branch 'development' into missing-logs
Umang01-hash Nov 18, 2024
7fa66ec
temp
coolwednesday Nov 18, 2024
fe8d419
implementing review suggestions
coolwednesday Nov 18, 2024
eef56e2
corrected incorrect spacing in comments
coolwednesday Nov 18, 2024
5b21715
Bump google.golang.org/protobuf from 1.35.1 to 1.35.2 (#1216)
dependabot[bot] Nov 19, 2024
f16d428
Bump go.opentelemetry.io/otel/sdk from 1.31.0 to 1.32.0 (#1224)
dependabot[bot] Nov 19, 2024
98a2d56
Bump golang.org/x/text from 0.19.0 to 0.20.0 (#1219)
dependabot[bot] Nov 19, 2024
eafd85e
Bump modernc.org/sqlite from 1.33.1 to 1.34.1 (#1221)
dependabot[bot] Nov 19, 2024
1782fc4
Bump go.opentelemetry.io/otel/exporters/zipkin from 1.31.0 to 1.32.0 …
dependabot[bot] Nov 19, 2024
79189e1
Bump google.golang.org/api from 0.204.0 to 0.206.0 (#1217)
dependabot[bot] Nov 19, 2024
94715b0
Bump go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc …
dependabot[bot] Nov 19, 2024
1bf0da0
Bump go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp (#…
dependabot[bot] Nov 19, 2024
9eace35
shifting all status: connecting logs to debug
coolwednesday Nov 20, 2024
17daaeb
removed go.mod from examples
coolwednesday Nov 20, 2024
dc4ad24
shifting all status: connecting logs to debug
coolwednesday Nov 20, 2024
eac6f69
reverting mock files and other changes
coolwednesday Nov 20, 2024
8887454
Merge branch 'development' into missing-logs
coolwednesday Nov 20, 2024
c0b027e
minor changes
coolwednesday Nov 20, 2024
e659050
minor changes
coolwednesday Nov 20, 2024
09e9299
update go.mod of ftp/s3/sftp
coolwednesday Nov 20, 2024
35bbc72
removing exclude build commands for future addition of external datas…
coolwednesday Nov 21, 2024
1e6fc6b
revert deleted go.mod in examples
coolwednesday Nov 21, 2024
4c18d9d
add debugf in interface wherever needed
coolwednesday Nov 21, 2024
2c8ac55
removed repeating logs in NATS: resolving review comment
coolwednesday Nov 21, 2024
88ad0e2
added missed return statements
coolwednesday Nov 22, 2024
cd2f9fd
Merge branch 'development' into missing-logs
vikash Nov 24, 2024
8ee67c0
resolving merge conflicts
coolwednesday Nov 26, 2024
ff5f16e
Merge branch 'development' into missing-logs
coolwednesday Nov 26, 2024
3c5d5b2
Merge branch 'development' into missing-logs
aryanmehrotra Nov 26, 2024
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
4 changes: 3 additions & 1 deletion pkg/gofr/datasource/file/ftp/fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ func (f *fileSystem) Connect() {

ftpServer := fmt.Sprintf("%v:%v", f.config.Host, f.config.Port)

f.logger.Infof("connecting to FTP server at '%v'", ftpServer)

defer f.sendOperationStats(&FileLog{
Operation: "Connect",
Location: ftpServer,
Expand Down Expand Up @@ -116,7 +118,7 @@ func (f *fileSystem) Connect() {

status = "LOGIN SUCCESS"

f.logger.Logf("Connected to FTP server at '%v'", ftpServer)
f.logger.Infof("connected to FTP server at '%v'", ftpServer)
}

// Create creates an empty file on the FTP server.
Expand Down
2 changes: 1 addition & 1 deletion pkg/gofr/datasource/file/ftp/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ require (
github.com/rogpeppe/go-internal v1.10.0 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
)
13 changes: 6 additions & 7 deletions pkg/gofr/datasource/file/ftp/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,14 @@ github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjR
github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU=
go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc=
go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU=
go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM=
golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM=
golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.23.0 h1:F6D4vR+EHoL9/sWAWgAR1H2DcHr4PareCbAaCo1RpuU=
golang.org/x/term v0.23.0/go.mod h1:DgV24QBUrK6jhZXl+20l6UWznPlwAHm1Q1mGHtydmSk=
golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo=
golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.25.0 h1:WtHI/ltw4NvSUig5KARz9h521QvRC8RmF/cuYqifU24=
golang.org/x/term v0.25.0/go.mod h1:RPyXicDX+6vLxogjjRxjgD2TKtmAO6NZBsBRfrOLu7M=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
1 change: 1 addition & 0 deletions pkg/gofr/datasource/file/ftp/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
type Logger interface {
Debug(args ...interface{})
Logf(pattern string, args ...interface{})
Infof(pattern string, args ...interface{})
Errorf(pattern string, args ...interface{})
}

Expand Down
19 changes: 17 additions & 2 deletions pkg/gofr/datasource/file/ftp/mock_interface.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion pkg/gofr/datasource/file/s3/fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ func (f *fileSystem) Connect() {
Message: &msg,
}, time.Now())

f.logger.Infof("connecting to S3 bucket %s", f.config.BucketName)

// Load the AWS configuration
cfg, err := awsConfig.LoadDefaultConfig(context.TODO(),
awsConfig.WithRegion(f.config.Region),
Expand All @@ -109,7 +111,7 @@ func (f *fileSystem) Connect() {
st = statusSuccess
msg = "S3 Client connected."

f.logger.Logf("Connected to S3 bucket %s", f.config.BucketName)
f.logger.Infof("connected to S3 bucket %s", f.config.BucketName)
}

// Create creates a new file in the S3 bucket.
Expand Down
1 change: 1 addition & 0 deletions pkg/gofr/datasource/file/s3/fs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ func runS3Test(t *testing.T, testFunc func(fs file.FileSystemProvider)) {
mockMetrics := NewMockMetrics(ctrl)

mockLogger.EXPECT().Logf(gomock.Any(), gomock.Any()).AnyTimes()
mockLogger.EXPECT().Infof(gomock.Any(), gomock.Any()).AnyTimes()
mockLogger.EXPECT().Errorf(gomock.Any(), gomock.Any()).AnyTimes()
mockLogger.EXPECT().Debug(gomock.Any()).AnyTimes()

Expand Down
2 changes: 1 addition & 1 deletion pkg/gofr/datasource/file/s3/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ require (
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
)
13 changes: 6 additions & 7 deletions pkg/gofr/datasource/file/s3/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,13 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU=
go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc=
go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU=
go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM=
golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg=
golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.23.0 h1:F6D4vR+EHoL9/sWAWgAR1H2DcHr4PareCbAaCo1RpuU=
golang.org/x/term v0.23.0/go.mod h1:DgV24QBUrK6jhZXl+20l6UWznPlwAHm1Q1mGHtydmSk=
golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo=
golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.25.0 h1:WtHI/ltw4NvSUig5KARz9h521QvRC8RmF/cuYqifU24=
golang.org/x/term v0.25.0/go.mod h1:RPyXicDX+6vLxogjjRxjgD2TKtmAO6NZBsBRfrOLu7M=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
1 change: 1 addition & 0 deletions pkg/gofr/datasource/file/s3/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
type Logger interface {
Debug(args ...interface{})
Logf(pattern string, args ...interface{})
Infof(pattern string, args ...interface{})
Errorf(pattern string, args ...interface{})
}

Expand Down
19 changes: 18 additions & 1 deletion pkg/gofr/datasource/file/s3/mock_interface.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Code generated by MockGen. DO NOT EDIT.
//Code generated by MockGen. DO NOT EDIT.
// Source: interface.go
//
// Generated by this command:
Expand Down Expand Up @@ -72,6 +72,23 @@ func (mr *MockLoggerMockRecorder) Errorf(pattern any, args ...any) *gomock.Call
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Errorf", reflect.TypeOf((*MockLogger)(nil).Errorf), varargs...)
}

// Infof mocks base method.
func (m *MockLogger) Infof(pattern string, args ...any) {
m.ctrl.T.Helper()
varargs := []any{pattern}
for _, a := range args {
varargs = append(varargs, a)
}
m.ctrl.Call(m, "Infof", varargs...)
}

// Infof indicates an expected call of Infof.
func (mr *MockLoggerMockRecorder) Infof(pattern any, args ...any) *gomock.Call {
mr.mock.ctrl.T.Helper()
varargs := append([]any{pattern}, args...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Infof", reflect.TypeOf((*MockLogger)(nil).Infof), varargs...)
}

// Logf mocks base method.
func (m *MockLogger) Logf(pattern string, args ...any) {
m.ctrl.T.Helper()
Expand Down
4 changes: 2 additions & 2 deletions pkg/gofr/datasource/file/sftp/fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func (f *fileSystem) UseMetrics(metrics interface{}) {

// Connect establishes a connection to FileSystem and registers metrics using the provided configuration when the client was Created.
func (f *fileSystem) Connect() {
f.logger.Debugf("connecting to SFTP server with host `%v` and port `%v`", f.config.Host, f.config.Port)
f.logger.Infof("connecting to SFTP server with host `%v` and port `%v`", f.config.Host, f.config.Port)

addr := fmt.Sprintf("%s:%d", f.config.Host, f.config.Port)

Expand All @@ -69,7 +69,7 @@ func (f *fileSystem) Connect() {

f.client = client

f.logger.Logf("connected to SFTP client successfully")
f.logger.Infof("connected to SFTP client successfully")
}

func (f *fileSystem) Create(name string) (File.File, error) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/gofr/datasource/file/sftp/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ require (
github.com/pmezard/go-difflib v1.0.0 // indirect
golang.org/x/sys v0.26.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
)
17 changes: 6 additions & 11 deletions pkg/gofr/datasource/file/sftp/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,12 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU=
go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc=
go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU=
go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw=
golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw=
golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54=
golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70=
golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw=
golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
Expand All @@ -41,15 +38,13 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg=
golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo=
golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.23.0 h1:F6D4vR+EHoL9/sWAWgAR1H2DcHr4PareCbAaCo1RpuU=
golang.org/x/term v0.23.0/go.mod h1:DgV24QBUrK6jhZXl+20l6UWznPlwAHm1Q1mGHtydmSk=
golang.org/x/term v0.25.0 h1:WtHI/ltw4NvSUig5KARz9h521QvRC8RmF/cuYqifU24=
golang.org/x/term v0.25.0/go.mod h1:RPyXicDX+6vLxogjjRxjgD2TKtmAO6NZBsBRfrOLu7M=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
Expand All @@ -62,4 +57,4 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
1 change: 1 addition & 0 deletions pkg/gofr/datasource/file/sftp/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ type Logger interface {
Debug(args ...interface{})
Debugf(pattern string, args ...interface{})
Logf(pattern string, args ...interface{})
Infof(pattern string, args ...any)
Errorf(pattern string, args ...interface{})
}

Expand Down
17 changes: 17 additions & 0 deletions pkg/gofr/datasource/file/sftp/mock_interface.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pkg/gofr/datasource/kv-store/badger/badger.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ func (c *client) Connect() {
}

c.db = db
c.logger.Infof("connected to BadgerDB at %v", c.configs.DirPath)
}

func (c *client) Get(ctx context.Context, key string) (string, error) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/gofr/datasource/kv-store/badger/mock_logger.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pkg/gofr/datasource/mongo/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
type Logger interface {
Debug(args ...interface{})
Logf(pattern string, args ...interface{})
Infof(pattern string, args ...interface{})
Errorf(pattern string, args ...interface{})
}

Expand Down
17 changes: 17 additions & 0 deletions pkg/gofr/datasource/mongo/mock_logger.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion pkg/gofr/datasource/mongo/mongo.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func (c *Client) UseTracer(tracer any) {

// Connect establishes a connection to MongoDB and registers metrics using the provided configuration when the client was Created.
func (c *Client) Connect() {
c.logger.Logf("connecting to mongoDB at %v to database %v", c.config.URI, c.config.Database)
c.logger.Infof("connecting to MongoDB at %v to database %v", c.config.URI, c.config.Database)

uri := c.config.URI

Expand All @@ -98,6 +98,8 @@ func (c *Client) Connect() {
c.metrics.NewHistogram("app_mongo_stats", "Response time of MONGO queries in milliseconds.", mongoBuckets...)

c.Database = m.Database(c.config.Database)

c.logger.Infof("connected to MongoDB at %v to database %v", c.config.URI, c.config.Database)
}

// InsertOne inserts a single document into the specified collection.
Expand Down
Loading
Loading