Skip to content

Commit 0c4a744

Browse files
committed
Even more verbose logging of tokens
1 parent d591d28 commit 0c4a744

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

github_api.cr

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,17 @@ end
3232
struct InstallationToken < Token
3333
include JSON::Serializable
3434
getter token : String
35+
property! installation_id : InstallationId
3536

3637
def initialize(@token : String)
3738
end
39+
40+
def to_s
41+
if (installation_id = @installation_id)
42+
Log.info { "Using token for ##{installation_id}" }
43+
end
44+
super
45+
end
3846
end
3947

4048
struct OAuthToken < Token
@@ -70,7 +78,9 @@ class GitHubAppAuth
7078
headers: {Authorization: jwt}
7179
)
7280
resp.raise_for_status
73-
InstallationToken.from_json(resp.body)
81+
tok = InstallationToken.from_json(resp.body)
82+
tok.installation_id = installation_id
83+
tok
7484
end
7585

7686
TOKEN_EXPIRATION = 55.minutes

0 commit comments

Comments
 (0)