[Common] Replaced std::cerr with LoggerE().
authorPawel Andruszkiewicz <p.andruszkie@samsung.com>
Fri, 4 Sep 2015 07:53:33 +0000 (09:53 +0200)
committerPawel Andruszkiewicz <p.andruszkie@samsung.com>
Fri, 4 Sep 2015 07:53:33 +0000 (09:53 +0200)
[Verification] Code compiles, behaviour not changed.

Change-Id: I4d15d545af342bccf33754088ca8a97ea2a18fc6
Signed-off-by: Pawel Andruszkiewicz <p.andruszkie@samsung.com>
src/common/XW_Extension.cc
src/common/extension.cc

index b23e455c66572f66d8050f7cb00b67aca03e385b..751779136119b9793048baa2184b65af2eab3f88 100755 (executable)
@@ -38,8 +38,7 @@ int32_t Extension::Detail::XW_Initialize(XW_Extension extension, XW_GetInterface
   LoggerD("Enter");
   g_extension = CreateExtension();
   if (!g_extension) {
-    std::cerr << "Can't initialize extension: "
-              << "CreateExtension() returned NULL.\n";
+    LoggerE("Can't initialize extension: CreateExtension() returned NULL.");
     return XW_ERROR;
   }
   return XW_OK;
index 835b7ab0466e61afaa5cbd5b36e38b74b1ddbdb9..0187296356503c9622d55b9edf50905fb1cb76cd 100755 (executable)
@@ -42,15 +42,14 @@ bool InitializeInterfaces(XW_GetInterface get_interface) {
     g_core = reinterpret_cast<const XW_CoreInterface*>(
         get_interface(XW_CORE_INTERFACE));
     if (!g_core) {
-      std::cerr << "Can't initialize extension: error getting Core interface.\n";
+      LoggerE("Can't initialize extension: error getting Core interface.");
       return false;
     }
 
     g_messaging = reinterpret_cast<const XW_MessagingInterface*>(
         get_interface(XW_MESSAGING_INTERFACE));
     if (!g_messaging) {
-      std::cerr <<
-          "Can't initialize extension: error getting Messaging interface.\n";
+      LoggerE("Can't initialize extension: error getting Messaging interface.");
       return false;
     }
 
@@ -58,37 +57,36 @@ bool InitializeInterfaces(XW_GetInterface get_interface) {
         reinterpret_cast<const XW_Internal_SyncMessagingInterface*>(
             get_interface(XW_INTERNAL_SYNC_MESSAGING_INTERFACE));
     if (!g_sync_messaging) {
-      std::cerr <<
-          "Can't initialize extension: error getting SyncMessaging interface.\n";
+      LoggerE("Can't initialize extension: error getting SyncMessaging interface.");
       return false;
     }
 
     g_entry_points = reinterpret_cast<const XW_Internal_EntryPointsInterface*>(
         get_interface(XW_INTERNAL_ENTRY_POINTS_INTERFACE));
     if (!g_entry_points) {
-      std::cerr << "NOTE: Entry points interface not available in this version "
-                << "of runtime, ignoring entry point data for extensions.\n";
+      LoggerE("NOTE: Entry points interface not available in this version "
+              "of runtime, ignoring entry point data for extensions.");
     }
 
     g_runtime = reinterpret_cast<const XW_Internal_RuntimeInterface*>(
         get_interface(XW_INTERNAL_RUNTIME_INTERFACE));
     if (!g_runtime) {
-      std::cerr << "NOTE: runtime interface not available in this version "
-                << "of runtime, ignoring runtime variables for extensions.\n";
+      LoggerE("NOTE: runtime interface not available in this version "
+              "of runtime, ignoring runtime variables for extensions.");
     }
 
     g_permission = reinterpret_cast<const XW_Internal_PermissionsInterface*>(
         get_interface(XW_INTERNAL_PERMISSIONS_INTERFACE));
     if (!g_permission) {
-      std::cerr << "NOTE: permission interface not available in this version "
-        << "of runtime, ignoring permission for extensions.\n";
+      LoggerE("NOTE: permission interface not available in this version "
+              "of runtime, ignoring permission for extensions.");
     }
 
     g_data = reinterpret_cast<const XW_Internal_DataInterface*>(
         get_interface(XW_INTERNAL_DATA_INTERFACE));
     if (!g_data) {
-      std::cerr << "NOTE: data interface not available in this version of "
-        << "runtime, ignoring data for extensions.\n";
+      LoggerE("NOTE: data interface not available in this version of "
+              "runtime, ignoring data for extensions.");
     }
 
     initialized = true;
@@ -290,8 +288,8 @@ void Instance::PostMessage(Instance* that, const char* msg) {
 void Instance::PostMessage(const char* msg) {
   LoggerD("Enter");
   if (!xw_instance_) {
-    std::cerr << "Ignoring PostMessage() in the constructor or after the "
-              << "instance was destroyed.";
+    LoggerE("Ignoring PostMessage() in the constructor or after the "
+            "instance was destroyed.");
     return;
   }
   g_messaging->PostMessage(xw_instance_, msg);
@@ -301,8 +299,8 @@ void Instance::PostMessage(const char* msg) {
 void Instance::PostData(const char* msg, uint8_t* buffer, size_t len) {
   LoggerD("Enter");
   if (!xw_instance_) {
-    std::cerr << "Ignoring PostData() in the constructor or after the "
-              << "instance was destroyed.";
+    LoggerE("Ignoring PostData() in the constructor or after the "
+            "instance was destroyed.");
     return;
   }
   g_data->PostData(xw_instance_, msg, buffer, len);
@@ -312,8 +310,8 @@ void Instance::PostData(const char* msg, uint8_t* buffer, size_t len) {
 void Instance::SendSyncReply(const char* reply) {
   LoggerD("Enter");
   if (!xw_instance_) {
-    std::cerr << "Ignoring SendSyncReply() in the constructor or after the "
-              << "instance was destroyed.";
+    LoggerE("Ignoring SendSyncReply() in the constructor or after the "
+            "instance was destroyed.");
     return;
   }
   g_sync_messaging->SetSyncReply(xw_instance_, reply);
@@ -322,8 +320,8 @@ void Instance::SendSyncReply(const char* reply) {
 void Instance::SendSyncReply(const char* reply, uint8_t* buffer, size_t len) {
   LoggerD("Enter");
   if (!xw_instance_) {
-    std::cerr << "Ignoring SendSyncReply() in the constructor or after the "
-              << "instance was destroyed.";
+    LoggerE("Ignoring SendSyncReply() in the constructor or after the "
+            "instance was destroyed.");
     return;
   }
   g_data->SetSyncReply(xw_instance_, reply, buffer, len);
@@ -392,12 +390,12 @@ void ParsedInstance::HandleMessage(const char* msg, bool is_sync) {
     std::string err;
     picojson::parse(value, msg, msg + strlen(msg), &err);
     if (!err.empty()) {
-      std::cerr << "Ignoring message. " << err;
+      LoggerE("Ignoring message, error: %s", err.c_str());
       return;
     }
 
     if (!value.is<picojson::object>()) {
-      std::cerr << "Ignoring message. It is not an object.";
+      LoggerE("Ignoring message. It is not an object.");
       return;
     }
 
@@ -437,7 +435,7 @@ void ParsedInstance::HandleMessage(const char* msg, bool is_sync) {
 
 void ParsedInstance::HandleException(const PlatformException& ex) {
   LoggerD("Enter");
-  std::cerr << "Exception: " << ex.message();
+  LoggerE("Exception: %s", ex.message().c_str());
   picojson::value result = picojson::value(picojson::object());
   ReportError(ex, result.get<picojson::object>());
   SendSyncReply(result.serialize().c_str());
@@ -473,12 +471,12 @@ bool ParsedDataRequest::Parse(const char* msg) {
   std::string err;
   picojson::parse(value_, msg, msg + strlen(msg), &err);
   if (!err.empty()) {
-    std::cerr << "Ignoring message. " << err;
+    LoggerE("Ignoring message, error: %s", err.c_str());
     return false;
   }
 
   if (!value_.is<picojson::object>()) {
-    std::cerr << "Ignoring message. It is not an object.";
+    LoggerE("Ignoring message. It is not an object.");
     return false;
   }