[go: nahoru, domu]

Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

[Android] developers could change log level using javascript #2540

Merged
merged 1 commit into from
Jun 13, 2019

Conversation

YorkShen
Copy link
Contributor
  1. Add ConsoleLogModule, developers could change log using javascript. Ref demo http://editor.weex.io/vue/8fb63b977fad1bf816b9a9ad79a43fbd
  2. Print log to logcat and devtool only if WXEnviroment.sLogLevel is bigger than the log being printed.
  3. 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.
  4. Enable LogI no matter it's debuggable or not.
  5. 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.
@weex-bot
Copy link
weex-bot commented Jun 12, 2019
Fails
🚫 Failed to run assembleDebug task for android.
Messages
📖 android build verification finished.

Generated by 🚫 dangerJS

case "info":
logLevelEnum = LogLevel.INFO;
break;
case "debug":
Copy link
Contributor

Choose a reason for hiding this comment

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

Switch case 加上 default 吧

Copy link
Contributor Author

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

Choose a reason for hiding this comment

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

这里的 success 和 failue 表示啥意思?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

成功和失败,失败的原因一般是用户传的参数错误

Copy link
Contributor
@Darin726 Darin726 left a comment

Choose a reason for hiding this comment

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

LGTM

@Darin726 Darin726 merged commit b07f49c into apache:master Jun 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants