-
Notifications
You must be signed in to change notification settings - Fork 52
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
feat: set log level from config and API #56
Conversation
enable setting log from: - config `{logLevel: "DEBUG"}` - global flag `window.DEBUG_KALTURA_PLAYER` - query stirng param: `debugKalturaPlayer` pass config to kaltura-player and included packages: playkit, providers and UI We will need to refactor the actual API for set and get log level as today it actualy reflects only the playkit log level
this._uiManager = new PlaykitUI(this._player, {targetId: targetId}); | ||
this._provider = new OvpProvider(__VERSION__, config.partnerId, config.ks, config.env); | ||
this._logger = getLogger('KalturaPlayer' + Utils.Generator.uniqueId(5)); | ||
this._uiManager = new PlaykitUI(this._player, {targetId: targetId, logLevel: playerConfig.logLevel}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to split the configs?
We can't just do config.logLevel
?
src/setup.js
Outdated
@@ -20,6 +22,13 @@ import { | |||
* @returns {Player} - Player | |||
*/ | |||
function setup(targetId: string, options: Object): KalturaPlayer { | |||
if (isDebugMode()){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- maybe export this logic to
setLogLevel
method as part of the setup helpers? - better to do it after the initial validation of target id and providers config?
- prettify
src/utils/logger.js
Outdated
* @param {?string} name - the logger name | ||
* @returns {Object} - the log level | ||
*/ | ||
function getLogLevel(name?: string): Object{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prettify file
src/utils/setup-helpers.js
Outdated
* check the player debug mode according to config or URL query string params | ||
* @returns {boolean} - if to set debug mode or not | ||
*/ | ||
function isDebugMode(): void{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prettify file
Description of the Changes
enable setting log from:
{logLevel: "DEBUG"}
window.DEBUG_KALTURA_PLAYER
debugKalturaPlayer
pass config to kaltura-player and included packages: playkit, providers and UI
We will need to refactor the actual API for set and get log level as today it actualy reflects only the playkit log level
CheckLists