@@ -21,11 +21,11 @@ func (e *EndpointsManager) Create(ctx context.Context, name string) (EndpointEnt
2121
2222func (e * EndpointsManager ) Read (ctx context.Context , id int64 ) (EndpointEntity , error ) {
2323 if err := crud .ValidateID (id ); err != nil {
24- log .Debug ("endpoint read failed validation" , "id" , id )
24+ log .Warn ("endpoint read failed validation" , "id" , id )
2525 return EndpointEntity {}, crud .ErrInvalidInput
2626 }
2727
28- log .Debug ("reading endpoint" , "id" , id )
28+ log .DebugIf ("reading endpoint" , "id" , id )
2929 endpoint , err := e .DB .GetEndpoint (ctx , id )
3030 if err != nil {
3131 if err == sql .ErrNoRows {
@@ -45,11 +45,11 @@ func (e *EndpointsManager) Update(ctx context.Context, id int64, name string) (E
4545
4646func (e * EndpointsManager ) Delete (ctx context.Context , id int64 ) error {
4747 if err := crud .ValidateID (id ); err != nil {
48- log .Debug ("endpoint delete failed validation" , "id" , id )
48+ log .Warn ("endpoint delete failed validation" , "id" , id )
4949 return crud .ErrInvalidInput
5050 }
5151
52- log .Debug ("deleting endpoint" , "id" , id )
52+ log .DebugIf ("deleting endpoint" , "id" , id )
5353 err := e .DB .DeleteEndpoint (ctx , id )
5454 if err != nil {
5555 log .Error ("failed to delete endpoint" , "id" , id , "error" , err )
@@ -66,11 +66,11 @@ func (e *EndpointsManager) List(ctx context.Context) ([]EndpointEntity, error) {
6666
6767func (e * EndpointsManager ) ListByCollection (ctx context.Context , collectionID int64 , limit , offset int ) (* PaginatedEndpoints , error ) {
6868 if err := crud .ValidateID (collectionID ); err != nil {
69- log .Debug ("endpoint list failed collection validation" , "collection_id" , collectionID )
69+ log .Warn ("endpoint list failed collection validation" , "collection_id" , collectionID )
7070 return nil , crud .ErrInvalidInput
7171 }
7272
73- log .Debug ("listing paginated endpoints" , "collection_id" , collectionID , "limit" , limit , "offset" , offset )
73+ log .DebugIf ("listing paginated endpoints" , "collection_id" , collectionID , "limit" , limit , "offset" , offset )
7474
7575 total , err := e .DB .CountEndpointsByCollection (ctx , collectionID )
7676 if err != nil {
@@ -105,15 +105,15 @@ func (e *EndpointsManager) ListByCollection(ctx context.Context, collectionID in
105105
106106func (e * EndpointsManager ) CreateEndpoint (ctx context.Context , data EndpointData ) (EndpointEntity , error ) {
107107 if err := crud .ValidateID (data .CollectionID ); err != nil {
108- log .Debug ("endpoint creation failed collection validation" , "collection_id" , data .CollectionID )
108+ log .Warn ("endpoint creation failed collection validation" , "collection_id" , data .CollectionID )
109109 return EndpointEntity {}, crud .ErrInvalidInput
110110 }
111111 if err := crud .ValidateName (data .Name ); err != nil {
112- log .Debug ("endpoint creation failed name validation" , "name" , data .Name )
112+ log .Warn ("endpoint creation failed name validation" , "name" , data .Name )
113113 return EndpointEntity {}, crud .ErrInvalidInput
114114 }
115115 if data .Method == "" || data .URL == "" {
116- log .Debug ("endpoint creation failed - method and URL required" , "method" , data .Method , "url" , data .URL )
116+ log .Warn ("endpoint creation failed - method and URL required" , "method" , data .Method , "url" , data .URL )
117117 return EndpointEntity {}, crud .ErrInvalidInput
118118 }
119119
@@ -132,7 +132,7 @@ func (e *EndpointsManager) CreateEndpoint(ctx context.Context, data EndpointData
132132 queryParamsJSON = string (qpBytes )
133133 }
134134
135- log .Debug ("creating endpoint" , "collection_id" , data .CollectionID , "name" , data .Name , "method" , data .Method , "url" , data .URL )
135+ log .DebugIf ("creating endpoint" , "collection_id" , data .CollectionID , "name" , data .Name , "method" , data .Method , "url" , data .URL )
136136 endpoint , err := e .DB .CreateEndpoint (ctx , database.CreateEndpointParams {
137137 CollectionID : data .CollectionID ,
138138 Name : data .Name ,
@@ -153,15 +153,15 @@ func (e *EndpointsManager) CreateEndpoint(ctx context.Context, data EndpointData
153153
154154func (e * EndpointsManager ) UpdateEndpoint (ctx context.Context , id int64 , data EndpointData ) (EndpointEntity , error ) {
155155 if err := crud .ValidateID (id ); err != nil {
156- log .Debug ("endpoint update failed ID validation" , "id" , id )
156+ log .Warn ("endpoint update failed ID validation" , "id" , id )
157157 return EndpointEntity {}, crud .ErrInvalidInput
158158 }
159159 if err := crud .ValidateName (data .Name ); err != nil {
160- log .Debug ("endpoint update failed name validation" , "name" , data .Name )
160+ log .Warn ("endpoint update failed name validation" , "name" , data .Name )
161161 return EndpointEntity {}, crud .ErrInvalidInput
162162 }
163163 if data .Method == "" || data .URL == "" {
164- log .Debug ("endpoint update failed - method and URL required" , "method" , data .Method , "url" , data .URL )
164+ log .Warn ("endpoint update failed - method and URL required" , "method" , data .Method , "url" , data .URL )
165165 return EndpointEntity {}, crud .ErrInvalidInput
166166 }
167167
@@ -180,7 +180,7 @@ func (e *EndpointsManager) UpdateEndpoint(ctx context.Context, id int64, data En
180180 queryParamsJSON = string (qpBytes )
181181 }
182182
183- log .Debug ("updating endpoint" , "id" , id , "name" , data .Name , "method" , data .Method , "url" , data .URL )
183+ log .DebugIf ("updating endpoint" , "id" , id , "name" , data .Name , "method" , data .Method , "url" , data .URL )
184184 endpoint , err := e .DB .UpdateEndpoint (ctx , database.UpdateEndpointParams {
185185 Name : data .Name ,
186186 Method : data .Method ,
0 commit comments