-
Notifications
You must be signed in to change notification settings - Fork 1.8k
[Android] developers could change log level using javascript #2540
Conversation
YorkShen
commented
Jun 12, 2019
- Add ConsoleLogModule, developers could change log using javascript. Ref demo http://editor.weex.io/vue/8fb63b977fad1bf816b9a9ad79a43fbd
- Print log to logcat and devtool only if WXEnviroment.sLogLevel is bigger than the log being printed.
- Change WXEnviroment.sLogLevel to INFO under debug apk, change it to WARN otherwise. Before this change WXEnvironment.sApplication was always null when initializing WXEnviroment.sLogLevel, so WXEnviroment.sLogLevel was always debug regardless it's actually debuggable or not.
- Enable LogI no matter it's debuggable or not.
- Change the value of LogLevel.value, which should have no influence.
… using http://editor.weex.io/vue/8fb63b977fad1bf816b9a9ad79a43fbd 1. Add ConsoleLogModule, developers could change log using javascript. 1. Print log to logcat and devtool only if WXEnviroment.sLogLevel is bigger than the log being printed. 1. Change WXEnviroment.sLogLevel to INFO under debug apk, change it to WARN otherwise. Before this change WXEnvironment.sApplication was always null when initializing WXEnviroment.sLogLevel, so WXEnviroment.sLogLevel was always debug regardless it's actually debuggable or not. 1. Enable LogI no matter it's debuggable or not. 1. Change the value of LogLevel.value, which should have no influence.
Generated by 🚫 dangerJS |
case "info": | ||
logLevelEnum = LogLevel.INFO; | ||
break; | ||
case "debug": |
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.
Switch case 加上 default 吧
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.
default会导致logLevelEnum
取值为false,最终触发ret.put("status", "failure");
WXEnvironment.sLogLevel = logLevelEnum; | ||
ret.put("status", "success"); | ||
} else { | ||
ret.put("status", "failure"); |
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.
这里的 success 和 failue 表示啥意思?
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.
成功和失败,失败的原因一般是用户传的参数错误
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.
LGTM