-
Notifications
You must be signed in to change notification settings - Fork 10
Conversation
❤️ |
@@ -174,7 +201,7 @@ declare module Mobile { | |||
* @param {string} logLevel Selected logging level. | |||
* @return {string} The filtered result based on the input or null when the input data shouldn't be shown. | |||
*/ | |||
filterData(data: string, logLevel: string): string; | |||
filterData(data: string, logLevel: string, pid: string): string; |
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.
Add JSDocs for pid
@@ -142,6 +142,32 @@ declare module Mobile { | |||
interface IDeviceLogProvider { | |||
logData(line: string, platform: string, deviceIdentifier: string): void; | |||
setLogLevel(level: string, deviceIdentifier?: string): void; | |||
setApplictionPidForDevice(deviceIdentifier: string, pid: string): 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.
Add JSDocs
LGTM 👍 |
a0252f5
to
da88661
Compare
❤️ |
1 similar comment
❤️ |
0f89549
to
3e84715
Compare
❤️ |
57280ed
to
71fd9f9
Compare
❤️ |
💔 |
run ci |
❤️ |
71fd9f9
to
9775b92
Compare
❤️ |
1 similar comment
❤️ |
8c42566
to
c4e403f
Compare
❤️ |
iOS Simulator device logs are printed directly to process.stdout from the ios-sim-portable. However this makes it really difficult to filter the logs and provide them to different callers (for example AppBuilder CLI, NativeScript CLI, Proton). In order to fix this, use the ios-sim-portable just to start the process of getting device logs. Filter them in the CLI itself. Also change the logic in ios-log-filter to use process pid in case it's passed. For iOS Simulator we have filtered logs based on the PID of the application. With these changes, simulator logs are passed to ios-log-filter, so that's why we need process' PID there. When application is restarted (during livesync for example), we set the PID again and the filter will use the new PID. Add unit tests to verify passing PID to iOSLogFilter works correctly.
c4e403f
to
1cd1804
Compare
❤️ |
if(deviceIdentifier) { | ||
this.devicesLogLevel[deviceIdentifier] = logLevel.toUpperCase(); | ||
if (deviceIdentifier) { | ||
this.devicesLogOptions[deviceIdentifier] = this.devicesLogOptions[deviceIdentifier] || <Mobile.IDeviceLogOptions> { }; |
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.
Can you extract this check and the set of the device log option on the line below in a method for example setDeviceLogOption
:
protected setDeviceLogOption(deviceId: string, optionName: string, value: string): void {
this.devicesLogOptions[deviceId] = this.devicesLogOptions[deviceId] || <Mobile.IDeviceLogOptions> { };
this.devicesLogOptions[deviceId][optionName]= value;
}
_.each(this.devicesLogLevel, (deviceLogLevel: string, deviceId: string) => { | ||
this.devicesLogLevel[deviceId] = this.$logFilter.loggingLevel; | ||
|
||
_.each(this.devicesLogOptions, (deviceLogLevel: string, deviceId: string) => { |
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.
You can use _.keys
here instead of _.each
because you don't use the deviceLogLevel: string
.
@TsvetanMilanov nice catch, comments are handled in the code ;) |
78da1b2
to
dd4b91c
Compare
❤️ |
1 similar comment
❤️ |
dd4b91c
to
e475807
Compare
❤️ |
logLevel = logLevel || this.$logFilter.loggingLevel; | ||
|
||
if (deviceIdentifier) { | ||
logLevel = (this.devicesLogOptions[deviceIdentifier] && this.devicesLogOptions[deviceIdentifier].logLevel) || this.$logFilter.loggingLevel; |
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 code seems really strange. setLogLevelForDevice
method does not use the passed logLevel.
Consider either removing the logLevel
parameter or using it here:
logLevel = (this.devicesLogOptions[deviceIdentifier] && this.devicesLogOptions[deviceIdentifier].logLevel) || 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.
fixed ;)
In many cases we need the propertyName and pass it to another function. However in case we use string and rename the property in the future, we almost always forget to update the string. Introduce helper function that accepts function as argument. The argument function must return the property which name we need. Add unit tests for the helper method. Use the new method to simplify setting of deviceLogOptions.
e475807
to
fc329b6
Compare
❤️ |
iOS Simulator device logs are printed directly to process.stdout from the ios-sim-portable. However this makes it really difficult to filter the logs and provide them to different callers (for example AppBuilder CLI, NativeScript CLI, Proton).
In order to fix this, use the ios-sim-portable just to start the process of getting device logs. Filter them in the CLI itself.
Also change the logic in ios-log-filter to use process pid in case it's passed. For iOS Simulator we have filtered logs based on the PID of the application. With these changes, simulator logs are passed to ios-log-filter, so that's why we need process' PID there.
When application is restarted (during livesync for example), we set the PID again and the filter will use the new PID.
Merge AFTER NativeScript/ios-sim-portable#79