extern CAGlobals_t caglobals;
+typedef enum
+{
+ CA_LOG_LEVEL_ALL = 1, // all logs.
+ CA_LOG_LEVEL_INFO, // debug level is disabled.
+} CAUtilLogLevel_t;
+
/**
* Callback function type for request delivery.
* @param[out] object Endpoint object from which the request is received.
*/
CAResult_t CAGetIpv6AddrScope(const char *addr, CATransportFlags_t *scopeLevel);
+/**
+ * set CAUtil log preference.
+ * @param[in] level ::CAUtilLogLevel_t value
+ * @param[in] hidePrivateLogEntries Private Log Entries.
+ * Example:
+ * true : hide private log.
+ * false : show private log.
+ * (privacy : uid, did, access token, etc)
+ */
+void CAUtilSetLogLevel(CAUtilLogLevel_t level, bool hidePrivateLogEntries);
+
#ifdef __cplusplus
} /* extern "C" */
#endif //__cplusplus
{
return CAGetIpv6AddrScopeInternal(addr, scopeLevel);
}
+
+void CAUtilSetLogLevel(CAUtilLogLevel_t level, bool hidePrivateLogEntries)
+{
+ OIC_LOG(DEBUG, TAG, "CAUtilSetLogLevel");
+ LogLevel logLevel = DEBUG;
+ switch(level)
+ {
+ case CA_LOG_LEVEL_INFO:
+ logLevel = INFO;
+ break;
+ case CA_LOG_LEVEL_ALL:
+ default:
+ logLevel = DEBUG;
+ break;
+ }
+
+ OCSetLogLevel(logLevel, hidePrivateLogEntries);
+}
} OCTransportBTFlags_t;
/**
+ * Log level to print can be controlled through this enum.
+ * And privacy logs contained uid, Token, Device id, etc can also disable.
+ * This enum (OCLogLevel) must be kept synchronized with
+ * CAUtilLogLevel_t (in CACommon.h).
+ */
+typedef enum
+{
+ OC_LOG_LEVEL_ALL = 1, // all logs.
+ OC_LOG_LEVEL_INFO, // debug level is disabled.
+} OCLogLevel;
+
+/**
* Enum layout assumes some targets have 16-bit integer (e.g., Arduino).
*/
typedef enum
*/
OCStackResult setBTConfigure(const CAUtilConfig& config);
+ /**
+ * set CAUtil log preference.
+ * @param[in] level ::OCLogLevel value.
+ * @param[in] hidePrivateLogEntries Private Log Entries.
+ * Example:
+ * true : hide private log.
+ * false : show private log.
+ * (privacy : uid, did, access token, etc)
+ */
+ void setLogLevel(OCLogLevel level, bool hidePrivateLogEntries);
+
#if defined(__WITH_DTLS__) || defined(__WITH_TLS__)
/**
* Select the cipher suite for TLS/DTLS handshake.
return convertCAResultToOCResult(ret);
}
+void CAManager::setLogLevel(OCLogLevel level, bool hidePrivateLogEntries)
+{
+ OIC_LOG(INFO, TAG, "setLogLevel");
+ CAUtilSetLogLevel((CAUtilLogLevel_t) level, hidePrivateLogEntries);
+}
+
#if defined(__WITH_DTLS__) || defined(__WITH_TLS__)
OCStackResult CAManager::setCipherSuite(const uint16_t cipher, OCTransportAdapter adapter)
{