diff --git a/github/data_source_github_actions_organization_registration_token.go b/github/data_source_github_actions_organization_registration_token.go index 44cb4ec4d3..4527c95c65 100644 --- a/github/data_source_github_actions_organization_registration_token.go +++ b/github/data_source_github_actions_organization_registration_token.go @@ -2,8 +2,8 @@ package github import ( "context" - "log" + "github.com/hashicorp/terraform-plugin-log/tflog" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -29,7 +29,9 @@ func dataSourceGithubActionsOrganizationRegistrationTokenRead(ctx context.Contex client := meta.(*Owner).v3client owner := meta.(*Owner).name - log.Printf("[DEBUG] Creating a GitHub Actions organization registration token for %s", owner) + tflog.Debug(ctx, "Creating a GitHub Actions organization registration token", map[string]any{ + "owner": owner, + }) token, _, err := client.Actions.CreateOrganizationRegistrationToken(ctx, owner) if err != nil { return diag.Errorf("error creating a GitHub Actions organization registration token for %s: %v", owner, err) diff --git a/github/data_source_github_actions_registration_token.go b/github/data_source_github_actions_registration_token.go index 070d112b4d..a961063286 100644 --- a/github/data_source_github_actions_registration_token.go +++ b/github/data_source_github_actions_registration_token.go @@ -3,8 +3,8 @@ package github import ( "context" "fmt" - "log" + "github.com/hashicorp/terraform-plugin-log/tflog" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -36,7 +36,10 @@ func dataSourceGithubActionsRegistrationTokenRead(ctx context.Context, d *schema owner := meta.(*Owner).name repoName := d.Get("repository").(string) - log.Printf("[DEBUG] Creating a GitHub Actions repository registration token for %s/%s", owner, repoName) + tflog.Debug(ctx, "Creating a GitHub Actions repository registration token", map[string]any{ + "owner": owner, + "repository": repoName, + }) token, _, err := client.Actions.CreateRegistrationToken(ctx, owner, repoName) if err != nil { return diag.Errorf("error creating a GitHub Actions repository registration token for %s/%s: %v", owner, repoName, err) diff --git a/github/data_source_github_branch.go b/github/data_source_github_branch.go index 5fa22b5bac..d970a006f2 100644 --- a/github/data_source_github_branch.go +++ b/github/data_source_github_branch.go @@ -3,7 +3,6 @@ package github import ( "context" "errors" - "log" "net/http" "github.com/google/go-github/v85/github" @@ -54,7 +53,11 @@ func dataSourceGithubBranchRead(ctx context.Context, d *schema.ResourceData, met var ghErr *github.ErrorResponse if errors.As(err, &ghErr) { if ghErr.Response.StatusCode == http.StatusNotFound { - log.Printf("[DEBUG] Missing GitHub branch %s/%s (%s)", orgName, repoName, branchRefName) + tflog.Debug(ctx, "Missing GitHub branch", map[string]any{ + "owner": orgName, + "repository": repoName, + "branch_ref": branchRefName, + }) d.SetId("") return nil }