Skip to content

Commit

Permalink
Remove duplicated log
Browse files Browse the repository at this point in the history
  • Loading branch information
Swanseo0 committed Nov 29, 2023
1 parent 555c9e6 commit 9c0d429
Showing 1 changed file with 9 additions and 25 deletions.
34 changes: 9 additions & 25 deletions packages/webview_flutter/tizen/src/webview.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
#include <flutter_texture_registrar.h>
#include <tbm_surface.h>

#include <ostream>

#include "buffer_pool.h"
#include "ewk_internal_api_binding.h"
#include "log.h"
Expand Down Expand Up @@ -676,31 +674,17 @@ void WebView::OnConsoleMessage(void* data, Evas_Object* obj, void* event_info) {
Ewk_Console_Message* message = static_cast<Ewk_Console_Message*>(event_info);
Ewk_Console_Message_Level log_level =
EwkInternalApiBinding::GetInstance().console_message.LevelGet(message);
std::string source =
EwkInternalApiBinding::GetInstance().console_message.SourceGet(message);
int32_t line =
EwkInternalApiBinding::GetInstance().console_message.LineGet(message);
std::string text =
EwkInternalApiBinding::GetInstance().console_message.TextGet(message);
std::ostream& stream =
log_level == EWK_CONSOLE_MESSAGE_LEVEL_ERROR ? std::cerr : std::cout;
stream << "WebView: ";
if (!source.empty() && line > 0) {
stream << source << "(" << line << ") > ";
}
stream << text << std::endl;

if (obj) {
WebView* webview = static_cast<WebView*>(data);
if (webview->webview_controller_channel_) {
flutter::EncodableMap args = {
{flutter::EncodableValue("level"),
flutter::EncodableValue(ConvertLogLevelToString(log_level))},
{flutter::EncodableValue("message"), flutter::EncodableValue(text)},
};
webview->webview_controller_channel_->InvokeMethod(
"onConsoleMessage", std::make_unique<flutter::EncodableValue>(args));
}
WebView* webview = static_cast<WebView*>(data);
if (webview->webview_controller_channel_) {
flutter::EncodableMap args = {
{flutter::EncodableValue("level"),
flutter::EncodableValue(ConvertLogLevelToString(log_level))},
{flutter::EncodableValue("message"), flutter::EncodableValue(text)},
};
webview->webview_controller_channel_->InvokeMethod(
"onConsoleMessage", std::make_unique<flutter::EncodableValue>(args));
}
}

Expand Down

0 comments on commit 9c0d429

Please sign in to comment.