You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ma...@apache.org on 2016/12/12 17:37:46 UTC
incubator-mynewt-core git commit: oic;
add syscfg variable to turn off logging completely.
Repository: incubator-mynewt-core
Updated Branches:
refs/heads/develop cd99344df -> 9faa19192
oic; add syscfg variable to turn off logging completely.
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/9faa1919
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/9faa1919
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/9faa1919
Branch: refs/heads/develop
Commit: 9faa191927a650371b6cf2e177e48e7e865abd63
Parents: cd99344
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Mon Dec 12 09:36:56 2016 -0800
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Mon Dec 12 09:36:56 2016 -0800
----------------------------------------------------------------------
net/oic/include/oic/oc_log.h | 15 +++++++++++++++
net/oic/src/port/mynewt/log.c | 3 ++-
net/oic/syscfg.yml | 4 +++-
3 files changed, 20 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/9faa1919/net/oic/include/oic/oc_log.h
----------------------------------------------------------------------
diff --git a/net/oic/include/oic/oc_log.h b/net/oic/include/oic/oc_log.h
index ab3ca66..4ab711d 100644
--- a/net/oic/include/oic/oc_log.h
+++ b/net/oic/include/oic/oc_log.h
@@ -26,6 +26,11 @@ extern "C" {
extern struct log oc_log;
+/*
+ * XXXX, this should not be needed.
+ * Figure out why logging takes so much space even with LOG_LEVEL set to 4
+ */
+#if MYNEWT_VAL(OC_LOGGING)
#define OC_LOG_DEBUG(...) LOG_DEBUG(&oc_log, LOG_MODULE_IOTIVITY,__VA_ARGS__)
#define OC_LOG_INFO(...) LOG_INFO(&oc_log, LOG_MODULE_IOTIVITY,__VA_ARGS__)
#define OC_LOG_ERROR(...) LOG_ERROR(&oc_log, LOG_MODULE_IOTIVITY,__VA_ARGS__)
@@ -54,6 +59,16 @@ void oc_log_bytes(uint16_t lvl, void *addr, int len, int print_char);
oc_log_bytes(lvl, addr, len, 0); \
} \
} while(0)
+#else
+
+#define OC_LOG_DEBUG(...)
+#define OC_LOG_INFO(...)
+#define OC_LOG_ERROR(...)
+#define OC_LOG_ENDPOINT(...)
+#define OC_LOG_STR(...)
+#define OC_LOG_HEX(...)
+
+#endif
#ifdef __cplusplus
}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/9faa1919/net/oic/src/port/mynewt/log.c
----------------------------------------------------------------------
diff --git a/net/oic/src/port/mynewt/log.c b/net/oic/src/port/mynewt/log.c
index ce94387..9a877bf 100644
--- a/net/oic/src/port/mynewt/log.c
+++ b/net/oic/src/port/mynewt/log.c
@@ -34,7 +34,7 @@ oc_log_endpoint(uint16_t lvl, struct oc_endpoint *oe)
switch (oe->flags) {
#if (MYNEWT_VAL(OC_TRANSPORT_IP) == 1)
- case IP:
+ case IP: {
int len;
mn_inet_ntop(MN_PF_INET6, oe->ipv6_addr.address, tmp, sizeof(tmp));
@@ -42,6 +42,7 @@ oc_log_endpoint(uint16_t lvl, struct oc_endpoint *oe)
snprintf(tmp + len, sizeof(tmp) - len, "-%u\n", oe->ipv6_addr.port);
str = tmp;
break;
+ }
#endif
#if (MYNEWT_VAL(OC_TRANSPORT_GATT) == 1)
case GATT:
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/9faa1919/net/oic/syscfg.yml
----------------------------------------------------------------------
diff --git a/net/oic/syscfg.yml b/net/oic/syscfg.yml
index 47e9802..3d71e7d 100644
--- a/net/oic/syscfg.yml
+++ b/net/oic/syscfg.yml
@@ -62,4 +62,6 @@ syscfg.defs:
description: 'Platform payload size'
value: 256
-
+ OC_LOGGING:
+ description: 'Logging enabled'
+ value: 0