fix(sync): add backend name prefix to all OAuth log messages (#122)

* fix(sync): add backend name prefix to all OAuth log messages (#121)

Problem: four log messages in `oauth.lua` lacked the `self.name` backend
prefix, producing generic notifications instead of identifying which
backend (`gcal`/`gtasks`) triggered the message.

Solution: prepend `self.name .. ': '` to the four unprefixed messages
and drop the hardcoded "Google" from the browser prompt since `self.name`
already identifies the service.

* fix(sync): canonicalize all log prefixes across sync backends (#121)

Problem: log messages in `oauth.lua`, `gcal.lua`, `gtasks.lua`, and
`s3.lua` were inconsistent — some lacked a backend prefix, others used
sentence-case or bare error strings without identifying the source.

Solution: prefix all user-facing log messages with their backend name
(`gcal:`, `gtasks:`, `S3:`, `Google:`). Capitalize `S3` and `Google`
display names. Normalize casing and separator style (em dash) across
all sync log sites.
This commit is contained in:
Barrett Ruth 2026-03-10 11:26:16 -04:00 committed by GitHub
parent 1eb2e49096
commit 914633235a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 44 additions and 44 deletions

View file

@ -447,12 +447,12 @@ function OAuthClient:auth(on_complete)
end)
vim.ui.open(auth_url)
log.info('Opening browser for Google authorization...')
log.info(self.name .. ': Opening browser for authorization...')
vim.defer_fn(function()
if not server_closed then
close_server()
log.warn('OAuth callback timed out (120s).')
log.warn(self.name .. ': OAuth callback timed out (120s).')
end
end, 120000)
end
@ -490,14 +490,14 @@ function OAuthClient:_exchange_code(creds, code, code_verifier, port, on_complet
if result.code ~= 0 then
self:clear_tokens()
log.error('Token exchange failed.')
log.error(self.name .. ': Token exchange failed.')
return
end
local ok, decoded = pcall(vim.json.decode, result.stdout or '')
if not ok or not decoded.access_token then
self:clear_tokens()
log.error('Invalid token response.')
log.error(self.name .. ': Invalid token response.')
return
end
@ -540,7 +540,7 @@ M._BUNDLED_CLIENT_SECRET = BUNDLED_CLIENT_SECRET
M.BUNDLED_CLIENT_ID = BUNDLED_CLIENT_ID
M.google_client = M.new({
name = 'google',
name = 'Google',
scope = 'https://www.googleapis.com/auth/tasks' .. ' https://www.googleapis.com/auth/calendar',
port = 18392,
config_key = 'google',