Skip to content

Use a new method to pass if debug to fix debug logging in library#2330

Merged
fire-light42 merged 3 commits intorecloudstream:masterfrom
Luna712:library-fix-debug
Mar 13, 2026
Merged

Use a new method to pass if debug to fix debug logging in library#2330
fire-light42 merged 3 commits intorecloudstream:masterfrom
Luna712:library-fix-debug

Conversation

@Luna712
Copy link
Contributor

@Luna712 Luna712 commented Dec 13, 2025

Currently debug logging doesn't work at all, because it never works to know if its compiled with the debug flag, that would be easy to fix, however, that causes some conflict with build and configuration cache. Additionally, libraries should not directly depend on a compile flavor. We instead set a variable in the library from the Application.onCreate() method in order for the app to tell the library whether it is debug or not.

This also adds a new annotation, InternalAPI that is used for AppDebug since only the app should ever set that. If this part is not wanted, I can remove it, but it seems to be more standard also in other libraries to use an annotation like this for internal-only stuff.

We could also replace some permanently/unstable API usages with this annotation, such as the ones in PluginManager, which is a better usage than @Deprecated. Either way whether deprecated or this annotation is used, extensions could suppress it, but using this annotation like this would prevent us internally having to add suppressions, and make it overall easier to manage, as well as be semantically correct, as deprecated implies eventual removal while InternalAPI implies disallowed/discouraged usage permanently. At least in my opinion.

Currently debug logging doesn't work at all, because it never works to know if its compiled with the debug flag, that would be easy to fix, however, that causes some conflict with build and configuration cache. Additionally, libraries should not directly depend on a compile flavor. We instead set a variable in the library from the `Application.onCreate()` method in order for the *app* to tell the *library* whether it is debug or not.

This also adds a new annotation, `InternalAPI` that is used for `AppDebug` since only the app should ever set that. If this part is not wanted, I can remove it, but it seems to be more standard also in other libraries to use an annotation like this for internal-only stuff. 

We could also replace some permanently/unstable API usages with this annotation, such as the ones in `PluginManager`, which is a better usage than `@Deprecated`. Either way whether deprecated or this annotation is used, extensions could suppress it, but using this annotation like this would prevent us internally having to add suppressions, and make it overall easier to manage. At least in my opinion.
Copy link
Collaborator

@fire-light42 fire-light42 left a comment

Choose a reason for hiding this comment

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

Good catch and well written fix!

@fire-light42 fire-light42 merged commit 86cca03 into recloudstream:master Mar 13, 2026
2 checks passed
@Luna712 Luna712 deleted the library-fix-debug branch March 13, 2026 23:28
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