Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(ui): logging config handling #7143

Merged
merged 2 commits into from
Oct 18, 2024
Merged

Conversation

psychedelicious
Copy link
Collaborator

Summary

Introduce two-stage logging configuration and overrides for enabled status, log level and log namespaces.

The first stage in <InvokeAIUI />, before we set up redux (and therefore before we have access to the user's configured logging setup). In this stage, we use the overrides or default values.

The second stage is in <App />, after we set up redux, via useSyncLoggingConfig. In this stage, we use the overrides or the user's configured logging setup. This hook also handles pushing changes made by the user into localstorage.

Other changes:

  • Extract logging config to util function
  • Remove the useEffect from SettingsModal that was changing the logging settings
  • Remove extraneous log effects from useLogger

Related Issues / Discussions

n/a

QA Instructions

Should be no difference in behaviour:

  • You should see some debug logs at startup about rehydration
  • Logging should respect your settings. For example, if you disable the canvas namespace, you should get no logs while drawing on canvas, disabling logging overall should result in no longs, etc.

Merge Plan

n/a

Checklist

  • The PR has a short but descriptive title, suitable for a changelog
  • Tests added / updated (if applicable)
  • Documentation added / updated (if applicable)

Copy link
Collaborator

@maryhipp maryhipp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@psychedelicious psychedelicious enabled auto-merge (rebase) October 18, 2024 21:02
Introduce two-stage logging configuration and overrides for enabled status, log level and log namespaces.

The first stage in `<InvokeAIUI />`, before we set up redux (and therefore before we have access to the user's configured logging setup). In this stage, we use the overrides or default values.

The second stage is in `<App />`, after we set up redux, via `useSyncLoggingConfig`. In this stage, we use the overrides or the user's configured logging setup. This hook also handles pushing changes made by the user into localstorage.

Other changes:
- Extract logging config to util function
- Remove the `useEffect` from `SettingsModal` that was changing the logging settings
- Remove extraneous log effects from `useLogger`
- Export new `LoggingOverrides` type
@psychedelicious psychedelicious merged commit 0b43f5f into main Oct 18, 2024
14 checks passed
@psychedelicious psychedelicious deleted the psyche/refactor/ui/logging branch October 18, 2024 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
frontend PRs that change frontend files
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants