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

Introduce Debug Logging #568

Merged
merged 14 commits into from
Nov 25, 2024
Merged

Conversation

123mpozzi
Copy link
Contributor

@123mpozzi 123mpozzi commented Nov 22, 2024

Description

Debug logging provides detailed information primarily for debugging purposes, helping to diagnose problems and trace the flow of execution within the Player.

Changes

New static APIs to check and set whether debug logging is enabled:

  • isDebugLoggingEnabled
  • setDebugLogging(value: boolean)

Internally, this has been handled by adding a new module, because this is not a config like the others since it is static/global.

Test and Basic Usage

Important

For iOS, Use player version 3.77.3-a.1 or newer

Add the following to BasicPlayback:

// other imports ...
import { useTVGestures } from '../hooks';

+ DebugConfig.setDebugLogging(true); // Add it right after the imports

Can also leverage a player event to test the flag:

  const onPaused = useCallback((_: Event) => {
    if (DebugConfig.isDebugLoggingEnabled) {
      DebugConfig.setDebugLogging(false);
    } else {
      DebugConfig.setDebugLogging(true);
    }
  }, []);

Changing flag value after initialization, however, does not work for Android because of a limitation

Checklist

  • 🗒 CHANGELOG entry

@123mpozzi 123mpozzi self-assigned this Nov 22, 2024
@123mpozzi 123mpozzi marked this pull request as ready for review November 22, 2024 12:16
@123mpozzi 123mpozzi requested review from a team as code owners November 22, 2024 12:16
@123mpozzi
Copy link
Contributor Author

123mpozzi commented Nov 22, 2024

We should merge only after iOS SDK version 3.78.0 is used in the project

src/debug.ts Outdated Show resolved Hide resolved
src/debug.ts Outdated Show resolved Hide resolved
ios/DebugModule.swift Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
123mpozzi and others added 2 commits November 22, 2024 13:48
Co-authored-by: Roland Kákonyi <[email protected]>
Co-authored-by: Roland Kákonyi <[email protected]>
src/debug.ts Outdated Show resolved Hide resolved
@rolandkakonyi rolandkakonyi self-requested a review November 22, 2024 13:40
Copy link
Contributor

@rolandkakonyi rolandkakonyi left a comment

Choose a reason for hiding this comment

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

Changes and testing looks good!

DebugConfig._isDebugEnabled = value;
await DebugModule.setDebugLoggingEnabled(value);
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

TypeDoc note: I've discovered we can use @defaultValue 😮

@rolandkakonyi rolandkakonyi merged commit 9c56ce5 into development Nov 25, 2024
9 checks passed
@rolandkakonyi rolandkakonyi deleted the feature/introduce-debugconfig branch November 25, 2024 08:39
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