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.
This commit is contained in:
Barrett Ruth 2026-03-10 11:19:33 -04:00
parent 1eb2e49096
commit ee6c3f723b

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