fix: added documentation & fixed logging
This commit is contained in:
parent
71488dade9
commit
3fadaac69a
@ -16,14 +16,6 @@ func CreateUserSource(ctx context.Context, userSource models.UserSource) (models
|
||||
ctx, span, localLogger := utils.SetupTracing(ctx, tracer, "CreateUserSource")
|
||||
defer span.End()
|
||||
|
||||
localLogger = localLogger.WithFields(log.Fields{
|
||||
"user_source_id": userSource.ID,
|
||||
})
|
||||
|
||||
span.SetAttributes(
|
||||
attribute.String("user_source_id", string(userSource.SourceID)),
|
||||
)
|
||||
|
||||
utils.HandleEvent(span, localLogger, "Starting user source creation")
|
||||
|
||||
if client == nil {
|
||||
@ -38,10 +30,25 @@ func CreateUserSource(ctx context.Context, userSource models.UserSource) (models
|
||||
return models.UserSource{}, utils.HandleError(ctx, span, localLogger, result.Error)
|
||||
}
|
||||
|
||||
localLogger = localLogger.WithFields(log.Fields{
|
||||
"user_source_id": userSource.ID,
|
||||
})
|
||||
|
||||
span.SetAttributes(
|
||||
attribute.String("user_source_id", string(userSource.SourceID)),
|
||||
)
|
||||
|
||||
utils.HandleEvent(span, localLogger, "User source created successfully")
|
||||
return userSource, nil
|
||||
}
|
||||
|
||||
// UpdateUserSource updates the user source information in the database.
|
||||
// Only a few parameter can be updated:
|
||||
// - AccountID
|
||||
// - ScrapeTimeInterval
|
||||
// - AccountUsername
|
||||
// - LastScrapeTime
|
||||
// - AccountValidate
|
||||
func UpdateUserSource(ctx context.Context, userSource models.UserSource) error {
|
||||
ctx, span, localLogger := utils.SetupTracing(ctx, tracer, "UpdateUserSource")
|
||||
defer span.End()
|
||||
|
Loading…
Reference in New Issue
Block a user