Skip to content

fix: log actual providers cache path instead of function reference#3283

Open
Ajithkumar003-dev wants to merge 1 commit into
charmbracelet:mainfrom
Ajithkumar003-dev:fix/log-cache-path
Open

fix: log actual providers cache path instead of function reference#3283
Ajithkumar003-dev wants to merge 1 commit into
charmbracelet:mainfrom
Ajithkumar003-dev:fix/log-cache-path

Conversation

@Ajithkumar003-dev

Copy link
Copy Markdown

What

In UpdateProviders, the slog.Info call was passing cachePathFor (the function itself) as the "to" log attribute instead of invoking it with "providers" to get the resolved path string.

`go
// Before
slog.Info("Providers updated successfully", "count", len(providers), "from", pathOrURL, "to", cachePathFor)

// After
slog.Info("Providers updated successfully", "count", len(providers), "from", pathOrURL, "to", cachePathFor("providers"))
`

Why it matters

This caused the structured log line to record the function pointer address (e.g. 0x6c3f40) as the to field instead of the actual file path, making it impossible to tell from logs where providers were written to disk.

Compare with UpdateHyper 33 lines below, which already calls cachePathFor("hyper") correctly. This commit applies the same pattern to UpdateProviders.

Testing

Run crush update-providers and check that the log line now shows the full cache file path under the to key.

In UpdateProviders, the slog.Info call was passing cachePathFor (the
function itself) as the "to" log attribute instead of calling it with
"providers" to get the resolved path string. This caused the log line
to record the function pointer address rather than the cache file path,
making it impossible to tell from logs where providers were actually
written.

UpdateHyper (line 121) correctly calls cachePathFor("hyper"); this
commit applies the same pattern to UpdateProviders.

Co-Authored-By: Ajithkumar003-dev <Ajithkumar003-dev@users.noreply.github.com>
@charmcli

Copy link
Copy Markdown
Contributor

Thank you for your submission. We really appreciate it! Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request comment same as the below format.


I have read the Contributor License Agreement (CLA) and hereby sign the CLA.


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants