feat: 增加打印日志内容

This commit is contained in:
niushuai233 2022-10-28 13:32:59 +08:00
parent d9b4c6260f
commit 09a244d88d
3 changed files with 10 additions and 6 deletions

View File

@ -21,5 +21,6 @@ public interface Keys {
String APP_INIT = "AppInit";
String KEEP_DAY_SELECT = "KeepDaySelect";
String APP_SETUP = "AppSetup";
}
}

View File

@ -45,10 +45,11 @@ public class KeepDayDialogFragment extends DialogFragment {
private void addListener() {
binding.layoutLogKeepDayConfirm.setOnClickListener(v -> {
int value = binding.keepDayPicker.getValue();
XLog.KEEP_DAY = value;
String keepDayPickerValue = value + "";
DBHelper.configDeal(Keys.SETUP_LOG_KEEP_DAY, keepDayPickerValue);
XLog.v(Keys.Tag.KEEP_DAY_SELECT, "更新日志存储天数为: {}", keepDayPickerValue);
XLog.KEEP_DAY = value;
XLog.i(Keys.Tag.KEEP_DAY_SELECT, "更新日志存储天数为: {}", keepDayPickerValue);
((TextView)getActivity().findViewById(R.id.setup_log_keep_day_display)).setText(keepDayPickerValue);
this.dismiss();

View File

@ -79,9 +79,12 @@ public class NavSetUpFragment extends BaseFragment {
binding.setupLogLevelSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
String level = ((Spinner) parent.findViewById(R.id.setup_log_level_spinner)).getSelectedItem().toString();
String levelName = ((Spinner) parent.findViewById(R.id.setup_log_level_spinner)).getSelectedItem().toString();
DBHelper.configDeal(Keys.SETUP_LOG_LEVEL, levelName);
DBHelper.configDeal(Keys.SETUP_LOG_LEVEL, level);
XLog.ROOT_LEVEL = XLog.Level.transform(levelName);
XLog.ROOT_LEVEL_NAME = levelName;
XLog.i(Keys.Tag.APP_SETUP, "修改日志级别为: {}", XLog.ROOT_LEVEL_NAME);
}
@Override
@ -110,9 +113,8 @@ public class NavSetUpFragment extends BaseFragment {
*/
private void setupLogSwitchClickListener(View view) {
Boolean checked = binding.setupLogSwitchSwitch.isChecked();
XLog.SWITCH = checked;
DBHelper.configDeal(Keys.SETUP_LOG_SWITCH, checked.toString());
XLog.SWITCH = checked;
}
private void setupKeepDayClickListener(View view) {