G_VARIANT_TYPE("(s)"));
if (!value) {
- LoggerE("Failed to create instance for extension %s",
- extension_name.c_str());
+ LOGGER(ERROR) << "Failed to create instance for extension "
+ << extension_name;
return std::string();
}
G_VARIANT_TYPE("(s)"));
if (!value) {
- LoggerE("Failed to destroy instance %s", instance_id.c_str());
+ LOGGER(ERROR) << "Failed to destroy instance " << instance_id;
return;
}
G_VARIANT_TYPE("(s)"));
if (!value) {
- LoggerE("Failed to send synchronous message to ExtensionServer.");
+ LOGGER(ERROR) << "Failed to send synchronous message to ExtensionServer.";
return std::string();
}
kDBusInterfaceNameForExtension,
std::bind(&ExtensionClient::HandleSignal, this, _1, _2));
} else {
- LoggerE("Failed to connect to the dbus server for Extension.");
+ LOGGER(ERROR) << "Failed to connect to the dbus server for Extension.";
return;
}
G_VARIANT_TYPE("(a(ssas))"));
if (!value) {
- LoggerE("Failed to get extension list from ExtensionServer.");
+ LOGGER(ERROR) << "Failed to get extension list from ExtensionServer.";
return;
}
v8::Handle<v8::Value> result = RunString(wrapped_api_code, &exception);
if (!result->IsFunction()) {
- LoggerE("Couldn't load JS API code for %s: %s",
- extension_name_.c_str(), exception.c_str());
+ LOGGER(ERROR) << "Couldn't load JS API code for "
+ << extension_name_ << " : " << exception;
return;
}
v8::Handle<v8::Function> callable_api_code =
try_catch.SetVerbose(true);
callable_api_code->Call(context->Global(), argc, argv);
if (try_catch.HasCaught()) {
- LoggerE("Exception while loading JS API code for %s: %s",
- extension_name_.c_str(), ExceptionToString(try_catch).c_str());
+ LOGGER(ERROR) << "Exception while loading JS API code for "
+ << extension_name_ << " : " << ExceptionToString(try_catch);
}
}
v8::TryCatch try_catch;
message_listener->Call(context->Global(), 1, args);
if (try_catch.HasCaught())
- LoggerE("Exception when running message listener: %s",
- ExceptionToString(try_catch).c_str());
+ LOGGER(ERROR) << "Exception when running message listener: "
+ << ExceptionToString(try_catch);
}
// static
}
if (!info[0]->IsFunction() && !info[0]->IsUndefined()) {
- LoggerE("Trying to set message listener with invalid value.");
+ LOGGER(ERROR) << "Trying to set message listener with invalid value.";
result.Set(false);
return;
}
v8::Local<v8::Value> module =
data->Get(v8::String::NewFromUtf8(isolate, kWrtExtensionModule));
if (module.IsEmpty() || module->IsUndefined()) {
- LoggerE("Trying to use extension from already destroyed context!");
+ LOGGER(ERROR) << "Trying to use extension from already destroyed context!";
return NULL;
}
// CHECK(module->IsExternal());
#include "bundle/extension_renderer_controller.h"
extern "C" void DynamicSetWidgetInfo(int /*widget_id*/) {
- LoggerD("InjectedBundle::DynamicSetWidgetInfo !!");
+ LOGGER(DEBUG) << "InjectedBundle::DynamicSetWidgetInfo !!";
}
extern "C" void DynamicPluginStartSession(int /*widget_id*/,
const char* uuid,
const char* /*theme*/,
const char* base_url) {
- LoggerD("InjectedBundle::DynamicPluginStartSession !!");
+ LOGGER(DEBUG) << "InjectedBundle::DynamicPluginStartSession !!";
if (base_url == NULL || wrt::utils::StartsWith(base_url, "http")) {
- LoggerD("External url not allowed plugin loading.");
+ LOGGER(ERROR) << "External url not allowed plugin loading.";
return;
}
extern "C" void DynamicPluginStopSession(
int /*widget_id*/, v8::Handle<v8::Context> context) {
- LoggerD("InjectedBundle::DynamicPluginStopSession !!");
+ LOGGER(DEBUG) << "InjectedBundle::DynamicPluginStopSession !!";
wrt::ExtensionRendererController& controller =
wrt::ExtensionRendererController::GetInstance();
extern "C" void DynamicUrlParsing(
std::string* old_url, std::string* new_url, int /*widget_id*/) {
- LoggerD("InjectedBundle::DynamicUrlParsing !!");
+ LOGGER(DEBUG) << "InjectedBundle::DynamicUrlParsing !!";
*new_url = *old_url;
}
extern "C" void DynamicDatabaseAttach(int /*attach*/) {
- LoggerD("InjectedBundle::DynamicDatabaseAttach !!");
+ LOGGER(DEBUG) << "InjectedBundle::DynamicDatabaseAttach !!";
}
extern "C" void DynamicOnIPCMessage(const Ewk_IPC_Wrt_Message_Data& /*data*/) {
- LoggerD("InjectedBundle::DynamicOnIPCMessage !!");
+ LOGGER(DEBUG) << "InjectedBundle::DynamicOnIPCMessage !!";
}
extern "C" void DynamicPreloading() {
- LoggerD("InjectedBundle::DynamicPreloading !!");
+ LOGGER(DEBUG) << "InjectedBundle::DynamicPreloading !!";
}
const std::vector<std::string>& entry_points) {
const std::string& extension_name = module->extension_name();
if (ContainsEntryPoint(extension_name)) {
- LoggerE("Can't register Extension Module named for extension "
- "'%s' in the Module System because name was already registered.",
- extension_name.c_str());
+ LOGGER(ERROR) << "Can't register Extension Module named for extension '"
+ << extension_name << "' in the Module System because name "
+ << " was already registered.";
return;
}
std::vector<std::string>::const_iterator it = entry_points.begin();
for (; it != entry_points.end(); ++it) {
if (ContainsEntryPoint(*it)) {
- LoggerE("Can't register Extension Module named for extension "
- "'%s' in the Module System because another extension "
- "has the entry point '%s'.",
- extension_name.c_str(), (*it).c_str());
+ LOGGER(ERROR) << "Can't register Extension Module named for extension '"
+ << extension_name << "' in the Module System because "
+ << "another extension has the entry point '"
+ << (*it) << "'.";
return;
}
}
v8::Handle<v8::Value> value =
EnsureTargetObjectForTrampoline(context, path, &error);
if (value->IsUndefined()) {
- LoggerE("Error installing trampoline for %s: %s.",
- entry_point.c_str(), error.c_str());
+ LOGGER(ERROR) << "Error installing trampoline for " << entry_point
+ << " : " << error;
return false;
}
std::string error;
v8::Handle<v8::Value> value = GetObjectForPath(context, path, &error);
if (value->IsUndefined()) {
- LoggerE("Error retrieving object for %s: %s.",
- entry_point.c_str(), error.c_str());
+ LOGGER(ERROR) << "Error retrieving object for " << entry_point
+ << " : " << error;
return false;
}
bool ret = SetTrampolineAccessorForEntryPoint(context, entry->name,
entry_ptr);
if (!ret) {
- LoggerE("Error installing trampoline for '%s'.", entry->name.c_str());
+ LOGGER(ERROR) << "Error installing trampoline for " << entry->name;
return false;
}
ret = SetTrampolineAccessorForEntryPoint(context, *it, entry_ptr);
if (!ret) {
// TODO(vcgomes): Remove already added trampolines when it fails.
- LoggerE("Error installing trampoline for '%s'.", entry->name.c_str());
+ LOGGER(ERROR) << "Error installing trampoline for " << entry->name;
return false;
}
}
std::string error;
v8::Handle<v8::Value> value = GetObjectForPath(context, path, &error);
if (value->IsUndefined()) {
- LoggerE("Error retrieving object for %s: %s.",
- extension_name.c_str(), error.c_str());
+ LOGGER(ERROR) << "Error retrieving object for " << extension_name << " : "
+ << error;
return;
}
const std::string& value) {
int result = appsvc_add_data(target, key.c_str(), value.c_str());
if (result < 0) {
- LoggerE("BundleAddData : appsvc_add_data fail");
+ LOGGER(ERROR) << "Failed to add data to appsvc.";
return false;
} else {
return true;
int result = appsvc_add_data_array(target, key.c_str(),
v.data(), n);
if (result < 0) {
- LoggerE("BundleAddDataArray appsvc_add_data_array fail");
+ LOGGER(ERROR) << "Failed to add an array of data to appsvc.";
return false;
} else {
return true;
bundle* result;
if (appsvc_create_result_bundle(app_control_bundle_,
&result) != APPSVC_RET_OK) {
- LoggerE("AppControl::Reply Fail : fail to create result bundle");
+ LOGGER(ERROR) << "Failed to craete result bundle.";
return false;
}
auto it = data.begin();
bool ApplicationData::LoadManifestData() {
std::string config_xml_path(application_path_ + kConfigXml);
if (!utils::Exists(config_xml_path)) {
- LoggerE("Failed to load manifest data. : No such file '%s'",
- config_xml_path.c_str());
+ LOGGER(ERROR) << "Failed to load manifest data. : No such file '"
+ << config_xml_path << "'.";
return false;
}
for (auto iter = handlers.begin(); iter != handlers.end(); ++iter) {
delete *iter;
}
- LoggerE("Failed to load manifest data. : %s",
- manifest_parser.GetErrorMessage().c_str());
+ LOGGER(ERROR) << "Failed to load manifest data : "
+ << manifest_parser.GetErrorMessage();
return false;
}
G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT,
NULL, NULL, &err);
if (!connection_) {
- LoggerE("Failed to connect to bus address %s : %s",
- address.c_str(), err->message);
+ LOGGER(ERROR) << "Failed to connect to bus address " << address
+ << " : " << err->message;
g_error_free(err);
return false;
}
connection_, NULL, "/", iface.c_str(), method.c_str(), parameters,
reply_type, G_DBUS_CALL_FLAGS_NONE, -1, NULL, &err);
if (!reply) {
- LoggerE("Failed to CallSync : %s", err->message);
+ LOGGER(ERROR) << "Failed to CallSync : " << err->message;
g_error_free(err);
}
} else {
gpointer user_data) {
DBusServer* self = reinterpret_cast<DBusServer*>(user_data);
if (!self) {
- LoggerE("DBusServer is NULL.");
+ LOGGER(ERROR) << "DBusServer is NULL.";
return;
}
auto callback = self->GetMethodCallback(interface_name);
gpointer user_data) {
DBusServer* self = reinterpret_cast<DBusServer*>(user_data);
if (!self) {
- LoggerE("DBusServer is NULL.");
+ LOGGER(ERROR) << "DBusServer is NULL.";
return NULL;
}
gpointer user_data) {
DBusServer* self = reinterpret_cast<DBusServer*>(user_data);
if (!self) {
- LoggerE("DBusServer is NULL.");
+ LOGGER(ERROR) << "DBusServer is NULL.";
return FALSE;
}
self->GetPeerCredentialsCallback();
if (callback && !callback(
g_dbus_connection_get_peer_credentials(connection))) {
- LoggerW("Invalid peer credentials");
+ LOGGER(WARN) << "Invalid peer credentials.";
g_dbus_connection_close_sync(connection, NULL, NULL);
}
GDBusNodeInfo* node_info = self->GetIntrospectionNodeInfo();
if (!node_info) {
- LoggerE("Introspection is not set.");
+ LOGGER(ERROR) << "Introspection is not set.";
return TRUE;
}
NULL,
&err);
if (reg_id == 0) {
- LoggerE("Failed to register object : %s", err->message);
+ LOGGER(ERROR) << "Failed to register object : " << err->message;
g_error_free(err);
}
}
guid, NULL, NULL, &err);
g_free(guid);
if (!server_) {
- LoggerE("Failed to create dbus server : %s", err->message);
+ LOGGER(ERROR) << "Failed to create dbus server : " << err->message;
g_error_free(err);
return;
}
G_CALLBACK(OnClientRequest), this);
g_dbus_server_start(server_);
-
- LoggerD("DBusServer(%s) has been started.", address.c_str());
}
std::string DBusServer::GetClientAddress() const {
GError* err = NULL;
node_info_ = g_dbus_node_info_new_for_xml(xml.c_str(), &err);
if (!node_info_) {
- LoggerE("Failed to create node info from introspection xml : %s",
- err->message);
+ LOGGER(ERROR) << "Failed to create node info from introspection xml : "
+ << err->message;
g_error_free(err);
}
}
iface.c_str(), signal_name.c_str(),
parameters, &err);
if (!ret) {
- LoggerE("Failed to emit signal : '%s.%s'",
- iface.c_str(), signal_name.c_str());
+ LOGGER(ERROR) << "Failed to emit signal : '"
+ << iface << '.' << signal_name << "'";
g_error_free(err);
}
}
std::string lang = localeToBCP47LangTag(str);
if (lang.length() == 0) {
- LoggerE("Language tag was invalid");
+ LOGGER(ERROR) << "Language tag was invalid";
return;
}
system_locales_.clear();
while (true) {
- LoggerD("Processing language description: %s", lang.c_str());
+ LOGGER(DEBUG) << "Processing language description: " << lang;
system_locales_.push_back(lang);
// compatibility with lower language Tag by SDK
#define WRT_COMMON_LOGGER_H_
#include <dlog.h>
+#include <sstream>
#undef LOGGER_TAG
#define LOGGER_TAG "WRT"
#define SLoggerW(fmt, args...) _LOGGER_SLOG(DLOG_WARN, fmt, ##args)
#define SLoggerE(fmt, args...) _LOGGER_SLOG(DLOG_ERROR, fmt, ##args)
+namespace wrt {
+namespace utils {
+
+class LogMessageVodify {
+ public:
+ LogMessageVodify() {}
+ void operator&(const std::ostream&) const {}
+};
+
+class LogMessage {
+ public:
+ LogMessage(int severity, const char* file, const char* func, const int line)
+ : severity_(severity), file_(file), func_(func), line_(line) {}
+ ~LogMessage() {
+ __dlog_print(LOG_ID_MAIN, severity_, LOGGER_TAG,
+ "%s: %s(%d) > %s", file_, func_, line_, stream_.str().c_str());
+ }
+ std::ostream& stream() { return stream_; }
+ private:
+ const int severity_;
+ const char* file_;
+ const char* func_;
+ const int line_;
+ std::ostringstream stream_;
+};
+
+} // namespace utils
+} // namespace wrt
+
+#define LOGGER(severity) \
+ wrt::utils::LogMessageVodify() & \
+ wrt::utils::LogMessage(DLOG_ ## severity, \
+ __FILE__, __FUNCTION__, __LINE__).stream()
+
+
#endif // WRT_COMMON_LOGGER_H_
namespace wrt {
void PrintProfileLog(const char* func, const char* tag) {
- LoggerD("[PROF] [%s] %s:%s", utils::GetCurrentMilliSeconds().c_str(),
- func, tag);
+ LOGGER(DEBUG) << "[PROF] [" << utils::GetCurrentMilliSeconds() << "] "
+ << func << ":" << tag;
}
} // namespace wrt
std::regex re(wildcard_str, std::regex_constants::icase);
return std::regex_match(target.begin(), target.end(), re);
} catch (std::regex_error& e) {
- LoggerE("regex exception happened");
+ LOGGER(ERROR) << "regex_error caught: " << e.what();
return false;
}
}
}
}
} else {
- LoggerW("AppWidgetInfo is NULL.");
+ LOGGER(WARN) << "AppWidgetInfo is NULL.";
}
if (!default_src.empty()) {
const AppControl* app_control) {
std::string operation = app_control->operation();
if (operation.empty()) {
- LoggerE("operation(mandatory) is NULL");
+ LOGGER(ERROR) << "operation(mandatory) is NULL";
return std::unique_ptr<Resource>(new Resource(GetDefaultOrEmpty()));
}
mime = GetMimeFromUri(uri);
}
- LoggerD("Passed AppControl data");
- LoggerD(" - operation : %s", operation.c_str());
- LoggerD(" - mimetype : %s", mime.c_str());
- LoggerD(" - uri : %s", uri.c_str());
+ LOGGER(DEBUG) << "Passed AppControl data";
+ LOGGER(DEBUG) << " - operation : " << operation;
+ LOGGER(DEBUG) << " - mimetype : " << mime;
+ LOGGER(DEBUG) << " - uri : " << uri;
if (application_data_ == NULL ||
application_data_->app_control_info_list() == NULL) {
if (url.compare(0, check.length(), check) == 0) {
url.erase(0, check.length());
} else {
- LoggerE("appid was invalid");
+ LOGGER(ERROR) << "Invalid appid";
return result;
}
} else if (url.compare(file_scheme) == 0) {
}
if (url.empty()) {
- LoggerE("URL Localization error");
+ LOGGER(ERROR) << "URL Localization error";
return result;
}
void* handle = dlopen(library_path_.c_str(), RTLD_LAZY);
if (!handle) {
- LoggerE("Error loading extension '%s' : %s",
- library_path_.c_str(), dlerror());
+ LOGGER(ERROR) << "Error loading extension '"
+ << library_path_ << "' : " << dlerror();
return false;
}
XW_Initialize_Func initialize = reinterpret_cast<XW_Initialize_Func>(
dlsym(handle, "XW_Initialize"));
if (!initialize) {
- LoggerE(
- "Error loading extension '%s' : couldn't get XW_Initialize function",
- library_path_.c_str());
+ LOGGER(ERROR) << "Error loading extension '" << library_path_
+ << "' : couldn't get XW_Initialize function.";
dlclose(handle);
return false;
}
int ret = initialize(xw_extension_, ExtensionAdapter::GetInterface);
if (ret != XW_OK) {
- LoggerE(
- "Error loading extension '%s' : XW_Initialize() returned error value.",
- library_path_.c_str());
+ LOGGER(ERROR) << "Error loading extension '" << library_path_
+ << "' : XW_Initialize() returned error value.";
dlclose(handle);
return false;
}
void ExtensionAdapter::RegisterExtension(Extension* extension) {
XW_Extension xw_extension = extension->xw_extension_;
if (!(xw_extension > 0 && xw_extension < next_xw_extension_)) {
- LoggerW("xw_extension (%d) is invalid.", xw_extension);
+ LOGGER(WARN) << "xw_extension (" << xw_extension << ") is invalid.";
return;
}
if (extension_map_.find(xw_extension) == extension_map_.end())
void ExtensionAdapter::UnregisterExtension(Extension* extension) {
XW_Extension xw_extension = extension->xw_extension_;
if (!(xw_extension > 0 && xw_extension < next_xw_extension_)) {
- LoggerW("xw_extension (%d) is invalid.", xw_extension);
+ LOGGER(WARN) << "xw_extension (" << xw_extension << ") is invalid.";
return;
}
if (extension_map_.find(xw_extension) != extension_map_.end())
void ExtensionAdapter::RegisterInstance(ExtensionInstance* instance) {
XW_Instance xw_instance = instance->xw_instance_;
if (!(xw_instance > 0 && xw_instance < next_xw_instance_)) {
- LoggerW("xw_instance (%d) is invalid.", xw_instance);
+ LOGGER(WARN) << "xw_instance (" << xw_instance << ") is invalid.";
return;
}
if (instance_map_.find(xw_instance) == instance_map_.end())
void ExtensionAdapter::UnregisterInstance(ExtensionInstance* instance) {
XW_Instance xw_instance = instance->xw_instance_;
if (!(xw_instance > 0 && xw_instance < next_xw_instance_)) {
- LoggerW("xw_instance (%d) is invalid.", xw_instance);
+ LOGGER(WARN) << "xw_instance (" << xw_instance << ") is invalid.";
return;
}
if (instance_map_.find(xw_instance) != instance_map_.end())
return &permissionsInterface1;
}
- LoggerW("Interface '%s' is not supported.", name);
+ LOGGER(WARN) << "Interface '" << name << "' is not supported.";
return NULL;
}
#define CHECK(x, xw) \
if (!x) { \
- LoggerW("Ignoring call. Invalid %s = %d", #xw, xw); \
+ LOGGER(WARN) << "Ignoring call. Invalid " << #xw << " = " << xw; \
return; \
}
return XW_ERROR;
}
+#undef CHECK
+#undef RETURN_IF_INITIALIZED
+
} // namespace wrt
// Connect to DBusServer for Application of Runtime
if (!dbus_application_client_.ConnectByName(
app_uuid_ + "." + std::string(kDBusNameForApplication))) {
- LoggerE("Failed to connect to the dbus server for Application.");
+ LOGGER(ERROR) << "Failed to connect to the dbus server for Application.";
return false;
}
std::string name = extension->name();
if (extension_symbols_.find(name) != extension_symbols_.end()) {
- LoggerW("Ignoring extension with name already registred. '%s'",
- name.c_str());
+ LOGGER(WARN) << "Ignoring extension with name already registred. '"
+ << name << "'";
return false;
}
Extension::StringVector entry_points = extension->entry_points();
for (auto it = entry_points.begin(); it != entry_points.end(); ++it) {
if (extension_symbols_.find(*it) != extension_symbols_.end()) {
- LoggerW("Ignoring extension with entry_point already registred. '%s'",
- (*it).c_str());
+ LOGGER(WARN) << "Ignoring extension with entry_point already registred. '"
+ << (*it) << "'";
return false;
}
}
g_variant_new("(s)", key), G_VARIANT_TYPE("(s)"));
if (!ret) {
- LoggerE("Failed to get runtime variable from Application. (%s)", key);
+ LOGGER(ERROR) << "Failed to get runtime variable from Application. ("
+ << key << ")";
return;
}
const std::string& method_name,
GVariant* parameters,
GDBusMethodInvocation* invocation) {
- LoggerD("HandleDBusMethod (%s)", method_name.c_str());
-
if (method_name == kMethodGetExtensions) {
OnGetExtensions(invocation);
} else if (method_name == kMethodCreateInstance) {
// find extension with given the extension name
auto it = extensions_.find(extension_name);
if (it == extensions_.end()) {
- LoggerE("Failed to find extension [%s]", extension_name.c_str());
+ LOGGER(ERROR) << "Failed to find extension '" << extension_name << "'";
g_dbus_method_invocation_return_error(
invocation, G_DBUS_ERROR, G_DBUS_ERROR_FAILED,
"Not found extension %s", extension_name.c_str());
// create instance
ExtensionInstance* instance = it->second->CreateInstance();
if (!instance) {
- LoggerE("Failed to create instance of extension [%s]",
- extension_name.c_str());
+ LOGGER(ERROR) << "Failed to create instance of extension '"
+ << extension_name << "'";
g_dbus_method_invocation_return_error(
invocation, G_DBUS_ERROR, G_DBUS_ERROR_FAILED,
"Failed to create instance of extension %s", extension_name.c_str());
// find instance with the given instance id
auto it = instances_.find(instance_id);
if (it == instances_.end()) {
- LoggerE("Failed to find instance [%s]", instance_id.c_str());
+ LOGGER(ERROR) << "Failed to find instance '" << instance_id << "'";
g_dbus_method_invocation_return_error(
invocation, G_DBUS_ERROR, G_DBUS_ERROR_FAILED,
"Not found instance %s", instance_id.c_str());
// find instance with the given instance id
auto it = instances_.find(instance_id);
if (it == instances_.end()) {
- LoggerE("Failed to find instance [%s]", instance_id.c_str());
+ LOGGER(ERROR) << "Failed to find instance '" << instance_id << "'";
g_dbus_method_invocation_return_error(
invocation, G_DBUS_ERROR, G_DBUS_ERROR_FAILED,
"Not found instance %s", instance_id.c_str());
const std::string& instance_id, const std::string& msg) {
auto it = instances_.find(instance_id);
if (it == instances_.end()) {
- LoggerE("Failed to find instance [%s]", instance_id.c_str());
+ LOGGER(ERROR) << "Failed to find instance '" << instance_id << "'";
return;
}
GDBusConnection* connection, const std::string& instance_id,
const std::string& msg) {
if (!connection || g_dbus_connection_is_closed(connection)) {
- LoggerE("Client connection is closed already.");
+ LOGGER(ERROR) << "Client connection is closed already.";
return;
}
// Receive AppID from arguments.
if (cmd->arguments().size() < 1) {
- LoggerE("uuid is required.");
+ LOGGER(ERROR) << "uuid is required.";
return false;
}
std::string uuid = cmd->arguments()[0];
// Start ExtensionServer
ExtensionServer server(uuid);
if (!server.Start()) {
- LoggerE("Failed to start extension server.");
+ LOGGER(ERROR) << "Failed to start extension server.";
return false;
}
- LoggerI("extension process has been started.");
+ LOGGER(INFO) << "extension process has been started.";
g_main_loop_run(loop);
- LoggerI("extension process is exiting.");
+ LOGGER(INFO) << "extension process is exiting.";
g_main_loop_unref(loop);
wrt::CommandLine* cmd = wrt::CommandLine::ForCurrentProcess();
if (cmd->HasOptionName(wrt::kSwitchExtensionServer)) {
// If cmd has the switch '--extension-server', run as extension server.
- LoggerI("Extension server process has been created.");
+ LOGGER(INFO) << "Extension server process has been created.";
if (!wrt::ExtensionServer::StartExtensionProcess()) {
- LoggerE("Failed to start extension server.");
+ LOGGER(ERROR) << "Failed to start extension server.";
exit(EXIT_FAILURE);
}
} else {
- // Default dehavior, run as runtime.
- LoggerI("Runtime process has been created.");
+ // Default behavior, run as runtime.
+ LOGGER(INFO) << "Runtime process has been created.";
ewk_init();
char* chromium_arg_options[] = {
argv[0],
void NativeWindow::DidDeleteRequested(void* /*data*/,
Evas_Object* /*obj*/, void* /*event_info*/) {
- LoggerD("didDeleteRequested");
+ LOGGER(DEBUG) << "didDeleteRequested";
elm_exit();
}
void NativeWindow::DidProfileChanged(void* /*data*/,
Evas_Object* /*obj*/, void* /*event_info*/) {
- LoggerD("didProfileChanged");
+ LOGGER(DEBUG) << "didProfileChanged";
}
Evas_Object* NativeWindow::evas_object() const {
ops.create = [](void* data) -> bool {
Runtime* runtime = reinterpret_cast<Runtime*>(data);
if (!runtime) {
- LoggerE("Runtime has not been created.");
+ LOGGER(ERROR) << "Runtime has not been created.";
return false;
}
return runtime->OnCreate();
ops.terminate = [](void* data) -> void {
Runtime* runtime = reinterpret_cast<Runtime*>(data);
if (!runtime) {
- LoggerE("Runtime has not been created.");
+ LOGGER(ERROR) << "Runtime has not been created.";
return;
}
runtime->OnTerminate();
ops.pause = [](void* data) -> void {
Runtime* runtime = reinterpret_cast<Runtime*>(data);
if (!runtime) {
- LoggerE("Runtime has not been created.");
+ LOGGER(ERROR) << "Runtime has not been created.";
return;
}
runtime->OnPause();
ops.resume = [](void* data) -> void {
Runtime* runtime = reinterpret_cast<Runtime*>(data);
if (!runtime) {
- LoggerE("Runtime has not been created.");
+ LOGGER(ERROR) << "Runtime has not been created.";
return;
}
runtime->OnResume();
ops.app_control = [](app_control_h app_control, void* data) -> void {
Runtime* runtime = reinterpret_cast<Runtime*>(data);
if (!runtime) {
- LoggerE("Runtime has not been created.");
+ LOGGER(ERROR) << "Runtime has not been created.";
return;
}
runtime->OnAppControl(app_control);
int ret = haptic_open(HAPTIC_DEVICE_0, &handle_);
if (ret != HAPTIC_ERROR_NONE) {
- LoggerE("Fail to open haptic device");
+ LOGGER(ERROR) << "Fail to open haptic device";
handle_ = 0;
return false;
}
void ExecExtensionProcess(const std::string& uuid) {
pid_t pid = -1;
if ((pid = fork()) < 0) {
- LoggerE("Failed to fork child process for extension process.");
+ LOGGER(ERROR) << "Failed to fork child process for extension process.";
}
if (pid == 0) {
CommandLine* cmd = CommandLine::ForCurrentProcess();
void*) -> void {
int x, y, w, h;
evas_object_geometry_get(obj, &x, &y, &w, &h);
- LoggerD("resize ! (%d, %d, %d, %d)\n", x, y, w, h);
+ LOGGER(DEBUG) << "resize ! ("
+ << x << ", " << y << ", " << w << ", " << h << ")";
};
evas_object_event_callback_add(view->evas_object(),
EVAS_CALLBACK_RESIZE,
if (app_data_->setting_info() != NULL &&
app_data_->setting_info()->background_support_enabled()) {
- LoggerD("gone background (backgroud support enabed)");
+ LOGGER(DEBUG) << "gone background (backgroud support enabed)";
return;
}
}
void WebApplication::OnLoadStart(WebView* /*view*/) {
- LoggerD("LoadStart");
+ LOGGER(DEBUG) << "LoadStart";
}
void WebApplication::OnLoadFinished(WebView* /*view*/) {
- LoggerD("LoadFinished");
+ LOGGER(DEBUG) << "LoadFinished";
}
void WebApplication::OnRendered(WebView* /*view*/) {
- LoggerD("Rendered");
+ LOGGER(DEBUG) << "Rendered";
}
void WebApplication::LaunchInspector(wrt::AppControl* appcontrol) {
if (method_name == kMethodNotifyEPCreated) {
// TODO(wy80.choi): send signal to injected bundle to make connection
// between injected bundle and extension process
- LoggerD("Call!!!! NotifyEPCreated!");
+ LOGGER(DEBUG) << "Call!!!! NotifyEPCreated!";
} else if (method_name == kMethodGetRuntimeVariable) {
gchar* key;
std::string value;
return EINA_TRUE;
auto result_handler = [view](bool result) {
- LoggerD("database quota Permission Result : %d", result);
+ LOGGER(DEBUG) << "database quota Permission Result : " << result;
ewk_view_exceeded_database_quota_reply(view, result);
};
std::stringstream url;
return EINA_TRUE;
auto result_handler = [view](bool result) {
- LoggerD("indexed db quota Permission Result : %d", result);
+ LOGGER(DEBUG) << "indexed db quota Permission Result : " << result;
ewk_view_exceeded_indexed_database_quota_reply(view, result);
};
std::stringstream url;
return EINA_TRUE;
auto result_handler = [view](bool result) {
- LoggerD("local file quota Permission Result : %d", result);
+ LOGGER(DEBUG) << "local file quota Permission Result : " << result;
ewk_view_exceeded_local_file_system_quota_reply(view, result);
};
std::stringstream url;
auto request_callback = [](Evas_Object*,
Ewk_Notification_Permission_Request* request,
void* user_data) {
- LoggerD("Notification Permission Request");
+ LOGGER(DEBUG) << "Notification Permission Request";
WebViewImpl* self = static_cast<WebViewImpl*>(user_data);
if (!self->listener_) {
ewk_notification_permission_reply(request, EINA_FALSE);
ewk_notification_permission_request_suspend(request);
auto result_handler = [request](bool result) {
- LoggerD("Notification Permission Result : %d", result);
+ LOGGER(DEBUG) << "Notification Permission Result : %d" << result;
ewk_notification_permission_reply(request, result);
};
const Ewk_Security_Origin* ewk_origin =
Evas_Object*,
Ewk_Geolocation_Permission_Request* request,
void* user_data) {
- LoggerD("Geolocation Permission Request");
+ LOGGER(DEBUG) << "Geolocation Permission Request";
WebViewImpl* self = static_cast<WebViewImpl*>(user_data);
if (self == NULL || self->listener_ == NULL) {
ewk_geolocation_permission_reply(request, EINA_FALSE);
const Ewk_Security_Origin* ewk_origin =
ewk_geolocation_permission_request_origin_get(request);
auto result_handler = [request](bool result) {
- LoggerD("Geolocation Permission Result : %d", result);
+ LOGGER(DEBUG) << "Geolocation Permission Result : " << result;
ewk_geolocation_permission_reply(request, result);
};
auto auth_callback = [](void* user_data,
Evas_Object*,
void* event_info) {
- LoggerD("Authentication Request");
+ LOGGER(DEBUG) << "Authentication Request";
WebViewImpl* self = static_cast<WebViewImpl*>(user_data);
Ewk_Auth_Challenge* auth_challenge =
static_cast<Ewk_Auth_Challenge*>(event_info);
auto result_handler = [auth_challenge](bool submit,
const std::string& id,
const std::string& password) {
- LoggerD("Authentication Result : submit %d", submit);
+ LOGGER(DEBUG) << "Authentication Result : submit = " << submit;
if (!submit) {
ewk_auth_challenge_credential_cancel(auth_challenge);
return;