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

feat: set log level from config and API #56

Merged
merged 9 commits into from
Nov 14, 2017
Merged

feat: set log level from config and API #56

merged 9 commits into from
Nov 14, 2017

Conversation

OrenMe
Copy link
Contributor

@OrenMe OrenMe commented Nov 12, 2017

Description of the Changes

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

CheckLists

  • changes have been done against master branch, and PR does not conflict
  • new unit / functional tests have been added (whenever applicable)
  • test are passing in local environment
  • Travis tests are passing (or test results are not worse than on master branch :))
  • Docs have been updated

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});
Copy link
Contributor

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()){
Copy link
Contributor

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

* @param {?string} name - the logger name
* @returns {Object} - the log level
*/
function getLogLevel(name?: string): Object{
Copy link
Contributor

Choose a reason for hiding this comment

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

prettify file

* 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{
Copy link
Contributor

Choose a reason for hiding this comment

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

prettify file

@dan-ziv dan-ziv merged commit 1c31f5d into master Nov 14, 2017
@dan-ziv dan-ziv deleted the loggerRefactor branch November 14, 2017 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants