Deploy logging SP inside SPs

Make SPs use logging SP. For this the log_client instance
needs to be initialized inside the SPs, using the provided
factory method.

Signed-off-by: Gabor Toth <gabor.toth2@arm.com>
Signed-off-by: Gabor Ambrus <gabor.ambrus@arm.com>
Change-Id: If4d41d15a1488943ceb00d9453b5c38d2bad10c1
diff --git a/deployments/crypto/crypto.cmake b/deployments/crypto/crypto.cmake
index 155099c..098861c 100644
--- a/deployments/crypto/crypto.cmake
+++ b/deployments/crypto/crypto.cmake
@@ -12,6 +12,7 @@
 		"components/rpc/common/interface"
 		"components/rpc/common/endpoint"
 		"components/service/common/include"
+		"components/service/common/client"
 		"components/service/common/serializer/protobuf"
 		"components/service/common/provider"
 		"components/service/crypto/provider"
diff --git a/deployments/crypto/env/commonsp/crypto_sp.c b/deployments/crypto/env/commonsp/crypto_sp.c
index e671954..7c84147 100644
--- a/deployments/crypto/env/commonsp/crypto_sp.c
+++ b/deployments/crypto/env/commonsp/crypto_sp.c
@@ -8,6 +8,7 @@
 #include "service/secure_storage/factory/storage_factory.h"
 #include "service/crypto/factory/crypto_provider_factory.h"
 #include "service/crypto/backend/mbedcrypto/mbedcrypto_backend.h"
+#include "service/log/factory/log_factory.h"
 #include "protocols/rpc/common/packed-c/status.h"
 #include "config/ramstore/config_ramstore.h"
 #include "config/loader/sp/sp_config_loader.h"
@@ -148,6 +149,13 @@
 		return false;
 	}
 
+	IMSG("Start discovering logging service");
+	if (log_factory_create()) {
+		IMSG("Logging service discovery successful");
+	} else {
+		EMSG("Logging service discovery failed, falling back to console log");
+	}
+
 	sp_res = sp_discovery_own_id_get(own_id);
 	if (sp_res != SP_RESULT_OK) {
 		EMSG("Failed to query own ID: %d", sp_res);
diff --git a/deployments/crypto/env/commonsp/crypto_sp.cmake b/deployments/crypto/env/commonsp/crypto_sp.cmake
index 5888b6a..a67087f 100644
--- a/deployments/crypto/env/commonsp/crypto_sp.cmake
+++ b/deployments/crypto/env/commonsp/crypto_sp.cmake
@@ -23,6 +23,8 @@
 		"components/rpc/common/endpoint"
 		"components/rpc/ts_rpc/common"
 		"components/rpc/ts_rpc/endpoint/sp"
+		"components/service/log/factory"
+		"components/service/log/client"
 )
 
 target_sources(crypto PRIVATE