-
Notifications
You must be signed in to change notification settings - Fork 83
fix: Added logger for react native which uses console.warn for error #360
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
Conversation
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.
If we change the logging package, we have to release new versions of everything. So instead let's implement the RN logger inside the optimizely-sdk package.
| * limitations under the License. | ||
| */ | ||
| var logging = require('@optimizely/js-sdk-logging'); | ||
| var browserIndex = require('./index.browser'); |
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.
Let's not make this entry point depend on another entry point. It should be independent.
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.
This means a lot of repeated code in both the entry points. is that ok?
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.
Yes that's OK. It's not that much repeated code, and we don't want the promise polyfill, the pending events dispatcher, or listening for the pagehide event.
2. Added ReactNative logger in optimizely-sdk package.
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.
Logger and entry point LGTM!
Please add unit test coverage for index.react_native.js (similar to what we have for the other entry points, for example: https://github.com/optimizely/javascript-sdk/blob/master/packages/optimizely-sdk/lib/index.node.tests.js).
| @@ -0,0 +1,38 @@ | |||
| var LogLevel = require('@optimizely/js-sdk-logging').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.
Please add the license header comment here.
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.
Done
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.
Please change this to 2019 only
| @@ -0,0 +1,462 @@ | |||
| /** | |||
| * Copyright 2016-2019, Optimizely | |||
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.
Please change this to 2019 only
| @@ -0,0 +1,38 @@ | |||
| var LogLevel = require('@optimizely/js-sdk-logging').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.
Please change this to 2019 only
| @@ -0,0 +1,83 @@ | |||
| /** | |||
| * Copyright 2016, Optimizely | |||
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.
Please change this to 2019 only
| @@ -0,0 +1,121 @@ | |||
| /** | |||
| * Copyright 2016-2017, 2019, Optimizely | |||
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.
Please change this to 2019 only
| assert.strictEqual(activate, 'control'); | ||
| }); | ||
|
|
||
| it('should be able to set and get a forced variation', function() { |
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.
Let's remove all these tests related to forced variation. This isn't relevant to the react native entry point.
Summary
React Native App shows a full screen Red Message when
console.erroris called. This appears to be distracting for the developers. Added a new logger for React Native which usesconsole.warnto log error.Test plan