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

Adding a Loggerable to Puppy() after bootstrap has no effect #87

Open
keniwhat opened this issue Mar 23, 2023 · 1 comment
Open

Adding a Loggerable to Puppy() after bootstrap has no effect #87

keniwhat opened this issue Mar 23, 2023 · 1 comment

Comments

@keniwhat
Copy link

keniwhat commented Mar 23, 2023

Once the LoggingSystem has been bootstrapped, adding a Loggerable to Puppy has no effect. This means it is no longer possible to add and remove loggers to a running system. This was possible in 0.5.0 but is broken in 0.7.0. It may be due to Sendable where the struct is copied when the LogHandler is created. However, the contract to add and remove loggers still exists but has no effect.

@luckyrat
Copy link

luckyrat commented Nov 9, 2023

This issue worried me when trying to find a log system suitable for privacy-preserving file log output within an iOS extension.

After working through the integration and seeing it function correctly even after calling bootstrap, I would hazzard a guess that the confusion relates to the Logger instance. Once a Logger has been created, changes to the Puppy handlers have no effect but the next Logger instance created does take on the new configuration.

I've used this approach successfully to enable file output only when a flag is set in UserDefaults. The nature of extensions means I have no "startup" code per-se and thus can only evaluate what the current status should be when iOS invokes my ViewController. That invocation may be on a new instance (process) of my extension or one that has been re-used so there is a common situation where bootstrap has already been called but the desire to log to a file may have changed since last invocation.

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

No branches or pull requests

2 participants