Skip to content

Commit

Permalink
[Logs] Cleaning code from debug logs (#108)
Browse files Browse the repository at this point in the history
* [Logs] Cleaning code from debug logs

This commit:
* removes redundant debug logs
* changes some valuable debug logs into LOGI level
* changes some logs to LOGW level

This commit is a part of #101

* [Logging] Added verbose-system-logs handling

All logs are filtered via flag usage:

* flutter-tizen run --verbose-system-logs
  all logs are visible in flutter console, including INFO
* flutter-tizen run
  only ERROR logs are visible in console

Related to #101

* [Logs] Clean remaining LOGD from code

* remove some redundant logs
* change some meaningful logs to LOGI or LOGW

This commit is a part of #101

* Review fixes
  • Loading branch information
pkosko authored and swift-kim committed Dec 17, 2021
1 parent e3cd5ed commit 7ba7db3
Show file tree
Hide file tree
Showing 13 changed files with 62 additions and 78 deletions.
2 changes: 1 addition & 1 deletion shell/platform/tizen/channels/key_event_channel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ KeyEventChannel::KeyEventChannel(flutter::BinaryMessenger* messenger)
KeyEventChannel::~KeyEventChannel() {}

void KeyEventChannel::SendKeyEvent(Ecore_Event_Key* key, bool is_down) {
FT_LOGD("code: %d, name: %s, mods: %d, type: %s", key->keycode, key->keyname,
FT_LOGI("code: %d, name: %s, mods: %d, type: %s", key->keycode, key->keyname,
key->modifiers, is_down ? kKeyDown : kKeyUp);

int gtk_keycode = 0;
Expand Down
8 changes: 4 additions & 4 deletions shell/platform/tizen/channels/lifecycle_channel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,21 @@ void LifecycleChannel::SendLifecycleMessage(const char message[]) {
}

void LifecycleChannel::AppIsInactive() {
FT_LOGD("send app lifecycle state inactive.");
FT_LOGI("send app lifecycle state inactive.");
SendLifecycleMessage(kInactive);
}

void LifecycleChannel::AppIsResumed() {
FT_LOGD("send app lifecycle state resumed.");
FT_LOGI("send app lifecycle state resumed.");
SendLifecycleMessage(kResumed);
}

void LifecycleChannel::AppIsPaused() {
FT_LOGD("send app lifecycle state paused.");
FT_LOGI("send app lifecycle state paused.");
SendLifecycleMessage(kPaused);
}

void LifecycleChannel::AppIsDetached() {
FT_LOGD("send app lifecycle state detached.");
FT_LOGI("send app lifecycle state detached.");
SendLifecycleMessage(kDetached);
}
4 changes: 2 additions & 2 deletions shell/platform/tizen/channels/localization_channel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void LocalizationChannel::SendLocales() {

flutter_locale = GetFlutterLocale(without_encoding_type.data());
if (flutter_locale) {
FT_LOGD("Choose Default locale[%s]", without_encoding_type.data());
FT_LOGI("Choose Default locale[%s]", without_encoding_type.data());
flutter_locales.push_back(flutter_locale);
}

Expand All @@ -52,7 +52,7 @@ void LocalizationChannel::SendLocales() {
}
}

FT_LOGD("Send %zu available locales", flutter_locales.size());
FT_LOGI("Send %zu available locales", flutter_locales.size());
// Send locales to engine
engine_->UpdateLocales(
const_cast<const FlutterLocale**>(flutter_locales.data()),
Expand Down
30 changes: 1 addition & 29 deletions shell/platform/tizen/channels/platform_channel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,6 @@ class FeedbackManager {
};

static std::string GetVibrateVariantName(const char* haptic_feedback_type) {
FT_LOGD(
"Enter FeedbackManager::GetVibrateVariantName(): haptic_feedback_type: "
"(%s)",
haptic_feedback_type);

if (!haptic_feedback_type) {
return "HapticFeedback.vibrate";
}
Expand All @@ -76,11 +71,6 @@ class FeedbackManager {
static std::string GetErrorMessage(ResultCode result_code,
const std::string& method_name,
const std::string& args = "") {
FT_LOGD(
"Enter FeedbackManager::GetErrorMessage(): result_code: [%d], "
"method_name: (%s), args: (%s)",
static_cast<int>(result_code), method_name.c_str(), args.c_str());

const auto method_name_with_args = method_name + "(" + args + ")";

switch (result_code) {
Expand All @@ -98,8 +88,6 @@ class FeedbackManager {
}

static FeedbackManager& GetInstance() {
FT_LOGD("Enter FeedbackManager::GetInstance()");

static FeedbackManager instance;
return instance;
}
Expand All @@ -108,7 +96,7 @@ class FeedbackManager {
FeedbackManager& operator=(const FeedbackManager&) = delete;

ResultCode Play(FeedbackType type, FeedbackPattern pattern) {
FT_LOGD("Enter FeedbackManager::Play(): type: [%d], pattern: [%d]",
FT_LOGI("Enter FeedbackManager::Play(): type: [%d], pattern: [%d]",
static_cast<int>(type), static_cast<int>(pattern));

if (ResultCode::kOk != initialization_status_) {
Expand All @@ -120,7 +108,6 @@ class FeedbackManager {
auto ret = feedback_play_type(static_cast<feedback_type_e>(type),
static_cast<feedback_pattern_e>(pattern));
if (FEEDBACK_ERROR_NONE == ret) {
FT_LOGD("feedback_play_type() succeeded");
return ResultCode::kOk;
}
FT_LOGE("feedback_play_type() failed with error: [%d] (%s)", ret,
Expand All @@ -131,9 +118,6 @@ class FeedbackManager {

private:
static ResultCode NativeErrorToResultCode(int native_error_code) {
FT_LOGD("Enter NativeErrorToResultCode: native_error_code: [%d]",
native_error_code);

switch (native_error_code) {
case FEEDBACK_ERROR_NONE:
return ResultCode::kOk;
Expand All @@ -150,30 +134,24 @@ class FeedbackManager {
}

FeedbackManager() {
FT_LOGD("Enter FeedbackManager::FeedbackManager()");

auto ret = feedback_initialize();
if (FEEDBACK_ERROR_NONE != ret) {
FT_LOGE("feedback_initialize() failed with error: [%d] (%s)", ret,
get_error_message(ret));
initialization_status_ = NativeErrorToResultCode(ret);
return;
}
FT_LOGD("feedback_initialize() succeeded");

initialization_status_ = ResultCode::kOk;
}

~FeedbackManager() {
FT_LOGD("Enter FeedbackManager::~FeedbackManager");

auto ret = feedback_deinitialize();
if (FEEDBACK_ERROR_NONE != ret) {
FT_LOGE("feedback_deinitialize() failed with error: [%d] (%s)", ret,
get_error_message(ret));
return;
}
FT_LOGD("feedback_deinitialize() succeeded");
}

ResultCode initialization_status_ = ResultCode::kUnknownError;
Expand All @@ -190,8 +168,6 @@ void PlatformChannel::HandleMethodCall(
ui_app_exit();
result->Success();
} else if (method == "SystemSound.play") {
FT_LOGD("SystemSound.play() call received");

const std::string pattern_str = call.arguments()[0].GetString();

const FeedbackManager::FeedbackPattern pattern =
Expand All @@ -214,8 +190,6 @@ void PlatformChannel::HandleMethodCall(
result->Error(error_cause, error_message);

} else if (method == "HapticFeedback.vibrate") {
FT_LOGD("HapticFeedback.vibrate() call received");

/*
* We use a single type of vibration (FEEDBACK_PATTERN_SIP) to implement
* HapticFeedback's vibrate, lightImpact, mediumImpact, heavyImpact
Expand Down Expand Up @@ -266,15 +240,13 @@ void PlatformChannel::HandleMethodCall(
for (rapidjson::Value::ConstValueIterator itr = list.Begin();
itr != list.End(); ++itr) {
const std::string& rot = itr->GetString();
FT_LOGD("Passed rotation: %s", rot.c_str());
rotations.push_back(orientation_mapping.at(rot));
}
if (rotations.size() == 0) {
// According do docs
// https://api.flutter.dev/flutter/services/SystemChrome/setPreferredOrientations.html
// "The empty list causes the application to defer to the operating
// system default."
FT_LOGD("No rotations passed, using default values");
rotations = {0, 90, 180, 270};
}
renderer_->SetPreferredOrientations(rotations);
Expand Down
9 changes: 4 additions & 5 deletions shell/platform/tizen/channels/platform_view_channel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,14 @@ void PlatformViewChannel::HandleMethodCall(
const auto method = call.method_name();
const auto& arguments = *call.arguments();

FT_LOGD("PlatformViewChannel method: %s", method.c_str());
FT_LOGI("PlatformViewChannel method: %s", method.c_str());
if (method == "create") {
std::string viewType = ExtractStringFromMap(arguments, "viewType");
int viewId = ExtractIntFromMap(arguments, "id");
double width = ExtractDoubleFromMap(arguments, "width");
double height = ExtractDoubleFromMap(arguments, "height");

FT_LOGD(
FT_LOGI(
"PlatformViewChannel create viewType: %s id: %d width: %f height: %f ",
viewType.c_str(), viewId, width, height);

Expand Down Expand Up @@ -213,7 +213,6 @@ void PlatformViewChannel::HandleMethodCall(
auto it = view_instances_.find(viewId);
if (viewId >= 0 && it != view_instances_.end()) {
if (method == "dispose") {
FT_LOGD("PlatformViewChannel dispose");
it->second->Dispose();
result->Success();
} else if (method == "resize") {
Expand Down Expand Up @@ -254,10 +253,10 @@ void PlatformViewChannel::HandleMethodCall(

result->Success();
} else if (method == "setDirection") {
FT_LOGD("PlatformViewChannel setDirection");
FT_LOGW("PlatformViewChannel setDirection - not implemented");
result->NotImplemented();
} else {
FT_LOGD("Unimplemented method: %s", method.c_str());
FT_LOGW("Unimplemented method: %s", method.c_str());
result->NotImplemented();
}
} else {
Expand Down
38 changes: 15 additions & 23 deletions shell/platform/tizen/channels/text_input_channel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ void TextInputChannel::InputPanelStateChangedCallback(
void* data,
Ecore_IMF_Context* context,
int value) {
FT_LOGD("Change input panel state[%d]", value);
FT_LOGI("Change input panel state[%d]", value);
if (!data) {
FT_LOGW("No Data");
return;
Expand Down Expand Up @@ -178,7 +178,7 @@ void TextInputChannel::InputPanelGeometryChangedCallback(
&self->current_keyboard_geometry_.y, &self->current_keyboard_geometry_.w,
&self->current_keyboard_geometry_.h);

FT_LOGD(
FT_LOGI(
"Current keyboard geometry x:[%d] y:[%d] w:[%d] h:[%d]",
self->current_keyboard_geometry_.x, self->current_keyboard_geometry_.y,
self->current_keyboard_geometry_.w, self->current_keyboard_geometry_.h);
Expand Down Expand Up @@ -289,7 +289,7 @@ void TextInputChannel::HandleMethodCall(
std::unique_ptr<flutter::MethodResult<rapidjson::Document>> result) {
const std::string& method = method_call.method_name();

FT_LOGD("Method : %s", method.data());
FT_LOGI("Handle Method : %s", method.data());

if (method.compare(kShowMethod) == 0) {
ShowSoftwareKeyboard();
Expand Down Expand Up @@ -395,7 +395,7 @@ void TextInputChannel::SendStateUpdate(const flutter::TextInputModel& model) {
kTextKey, rapidjson::Value(model.GetText(), allocator).Move(), allocator);
args->PushBack(editing_state, allocator);

FT_LOGD("Send text[%s]", model.GetText().data());
FT_LOGI("Send text[%s]", model.GetText().data());
channel_->InvokeMethod(kUpdateEditingStateMethod, std::move(args));
}

Expand Down Expand Up @@ -427,7 +427,7 @@ bool TextInputChannel::FilterEvent(Ecore_Event_Key* keyDownEvent) {
if (engine_->device_profile == DeviceProfile::kWearable) {
// FIXME: for wearable
in_select_mode_ = true;
FT_LOGD("Set select mode[true]");
FT_LOGI("Set select mode[true]");
}
}

Expand All @@ -447,7 +447,7 @@ bool TextInputChannel::FilterEvent(Ecore_Event_Key* keyDownEvent) {
// of the input panel is shifted to left!
// What we want is to move only the cursor on the text editor.
ResetCurrentContext();
FT_LOGD("Force redirect IME key-event[%s] to fallback",
FT_LOGW("Force redirect IME key-event[%s] to fallback",
keyDownEvent->keyname);
return false;
}
Expand All @@ -461,27 +461,27 @@ bool TextInputChannel::FilterEvent(Ecore_Event_Key* keyDownEvent) {
last_handled_ecore_event_keyname_ = keyDownEvent->keyname;
}

FT_LOGD("The %skey-event[%s] are%s filtered", isIME ? "IME " : "",
FT_LOGI("The %skey-event[%s] are%s filtered", isIME ? "IME " : "",
keyDownEvent->keyname, handled ? "" : " not");

if (!handled && !strcmp(keyDownEvent->key, "Return") && in_select_mode_ &&
engine_->device_profile == DeviceProfile::kWearable) {
in_select_mode_ = false;
handled = true;
FT_LOGD("Set select mode[false]");
FT_LOGI("Set select mode[false]");
}

return handled;
}

void TextInputChannel::NonIMFFallback(Ecore_Event_Key* keyDownEvent) {
FT_LOGD("NonIMFFallback key name [%s]", keyDownEvent->keyname);
FT_LOGI("NonIMFFallback key name [%s]", keyDownEvent->keyname);

// For mobile, fix me!
if (engine_->device_profile == DeviceProfile::kMobile &&
edit_status_ == EditStatus::kPreeditEnd) {
SetEditStatus(EditStatus::kNone);
FT_LOGD("Ignore key-event[%s]!", keyDownEvent->keyname);
FT_LOGW("Ignore key-event[%s]!", keyDownEvent->keyname);
return;
}

Expand Down Expand Up @@ -548,20 +548,19 @@ void TextInputChannel::EnterPressed(flutter::TextInputModel* model,
}

void TextInputChannel::OnCommit(std::string str) {
FT_LOGD("OnCommit str[%s]", str.data());
FT_LOGI("OnCommit str[%s]", str.data());
SetEditStatus(EditStatus::kCommit);

ConsumeLastPreedit();

active_model_->AddText(str);
FT_LOGD("Add Text[%s]", str.data());

SendStateUpdate(*active_model_);
SetEditStatus(EditStatus::kNone);
}

void TextInputChannel::OnPreedit(std::string str, int cursor_pos) {
FT_LOGD("OnPreedit str[%s], cursor_pos[%d]", str.data(), cursor_pos);
FT_LOGI("OnPreedit str[%s], cursor_pos[%d]", str.data(), cursor_pos);
SetEditStatus(EditStatus::kPreeditStart);
if (str.compare("") == 0) {
SetEditStatus(EditStatus::kPreeditEnd);
Expand All @@ -571,8 +570,6 @@ void TextInputChannel::OnPreedit(std::string str, int cursor_pos) {
(edit_status_ == EditStatus::kPreeditEnd &&
// For tv, fix me
last_handled_ecore_event_keyname_.compare("Return") != 0)) {
FT_LOGD("last_handled_ecore_event_keyname_[%s]",
last_handled_ecore_event_keyname_.data());
last_handled_ecore_event_keyname_ = "";
ConsumeLastPreedit();
}
Expand All @@ -584,13 +581,13 @@ void TextInputChannel::OnPreedit(std::string str, int cursor_pos) {
preedit_end_pos_ = active_model_->selection().base();
have_preedit_ = true;
SendStateUpdate(*active_model_);
FT_LOGD("preedit start pos[%d], preedit end pos[%d]", preedit_start_pos_,
FT_LOGI("preedit start pos[%d], preedit end pos[%d]", preedit_start_pos_,
preedit_end_pos_);
}
}
void TextInputChannel::OnPreeditForPlatformView(std::string str,
int cursor_pos) {
FT_LOGD("OnPreeditForPlatformView str[%s], cursor_pos[%d]", str.data(),
FT_LOGI("OnPreeditForPlatformView str[%s], cursor_pos[%d]", str.data(),
cursor_pos);

SetEditStatus(EditStatus::kPreeditStart);
Expand All @@ -602,8 +599,6 @@ void TextInputChannel::OnPreeditForPlatformView(std::string str,
(edit_status_ == EditStatus::kPreeditEnd &&
// For tv, fix me
last_handled_ecore_event_keyname_.compare("Return") != 0)) {
FT_LOGD("last_handled_ecore_event_keyname_[%s]",
last_handled_ecore_event_keyname_.data());
last_handled_ecore_event_keyname_ = "";
}

Expand All @@ -614,7 +609,6 @@ void TextInputChannel::OnPreeditForPlatformView(std::string str,
}

void TextInputChannel::ShowSoftwareKeyboard() {
FT_LOGD("Show input panel");
if (imf_context_ && !is_software_keyboard_showing_) {
is_software_keyboard_showing_ = true;
Ecore_IMF_Input_Panel_Layout panel_layout;
Expand All @@ -627,7 +621,6 @@ void TextInputChannel::ShowSoftwareKeyboard() {
}

void TextInputChannel::HideSoftwareKeyboard() {
FT_LOGD("Hide input panel");
if (imf_context_ && is_software_keyboard_showing_) {
is_software_keyboard_showing_ = false;
ResetCurrentContext();
Expand All @@ -636,7 +629,6 @@ void TextInputChannel::HideSoftwareKeyboard() {
}

void TextInputChannel::SetEditStatus(EditStatus edit_status) {
FT_LOGD("Set edit status[%d]", edit_status);
edit_status_ = edit_status;
}

Expand Down Expand Up @@ -699,7 +691,7 @@ void TextInputChannel::ConsumeLastPreedit() {
int count = preedit_end_pos_ - preedit_start_pos_;
active_model_->DeleteSurrounding(-count, count);
std::string after = active_model_->GetText();
FT_LOGD("Consume last preedit count:[%d] text:[%s] -> [%s]", count,
FT_LOGI("Consume last preedit count:[%d] text:[%s] -> [%s]", count,
before.data(), after.data());
SendStateUpdate(*active_model_);
}
Expand Down
Loading

0 comments on commit 7ba7db3

Please sign in to comment.