Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add newline to logs #307

Merged
merged 3 commits into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ add_definition(Z_FEATURE_SUBSCRIPTION=${Z_FEATURE_SUBSCRIPTION})
add_definition(Z_FEATURE_QUERY=${Z_FEATURE_QUERY})
add_definition(Z_FEATURE_QUERYABLE=${Z_FEATURE_QUERYABLE})
add_definition(Z_FEATURE_RAWETH_TRANSPORT=${Z_FEATURE_RAWETH_TRANSPORT})
add_compile_definitions("Z_BUILD_DEBUG=$<CONFIG:Debug>")
message(STATUS "Building with feature confing:\n\
* MULTI-THREAD: ${Z_FEATURE_MULTI_THREAD}\n\
* PUBLICATION: ${Z_FEATURE_PUBLICATION}\n\
Expand Down
80 changes: 41 additions & 39 deletions include/zenoh-pico/utils/logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,55 +17,57 @@

#include <stdio.h>

// Logging values
#define _Z_LOG_LVL_ERROR 1

Check warning

Code scanning / Cppcheck (reported by Codacy)

misra violation 2101 with no text in the supplied rule-texts-file Warning

misra violation 2101 with no text in the supplied rule-texts-file
#define _Z_LOG_LVL_INFO 2

Check warning

Code scanning / Cppcheck (reported by Codacy)

misra violation 2101 with no text in the supplied rule-texts-file Warning

misra violation 2101 with no text in the supplied rule-texts-file
#define _Z_LOG_LVL_DEBUG 3

Check warning

Code scanning / Cppcheck (reported by Codacy)

misra violation 2101 with no text in the supplied rule-texts-file Warning

misra violation 2101 with no text in the supplied rule-texts-file

// Timestamp function
static inline void __z_print_timestamp(void) {
char ret[64];
printf("[%s ", z_time_now_as_str(ret, sizeof(ret)));
}

// Logging macros
#define _Z_LOG_PREFIX(prefix) \
__z_print_timestamp(); \
printf(#prefix " ::%s] ", __func__);

#if (ZENOH_DEBUG == 3)
#define _Z_DEBUG(x, ...) \
_Z_LOG_PREFIX(DEBUG); \
printf(x, ##__VA_ARGS__);
#define _Z_DEBUG_CONTINUE(x, ...) printf(x, ##__VA_ARGS__);
#define _Z_INFO(x, ...) \
_Z_LOG_PREFIX(INFO); \
printf(x, ##__VA_ARGS__);
#define _Z_INFO_CONTINUE(x, ...) printf(x, ##__VA_ARGS__);
#define _Z_ERROR(x, ...) \
_Z_LOG_PREFIX(ERROR); \
printf(x, ##__VA_ARGS__);
#define _Z_ERROR_CONTINUE(x, ...) printf(x, ##__VA_ARGS__);
// Ignore print only if log deactivated and build is release
#if ZENOH_DEBUG == 0 && !defined(Z_BUILD_DEBUG)

Check warning

Code scanning / Cppcheck (reported by Codacy)

misra violation 2009 with no text in the supplied rule-texts-file Warning

misra violation 2009 with no text in the supplied rule-texts-file

#define _Z_DEBUG(...) (void)(0)

Check warning

Code scanning / Cppcheck (reported by Codacy)

misra violation 2101 with no text in the supplied rule-texts-file Warning

misra violation 2101 with no text in the supplied rule-texts-file
#define _Z_INFO(...) (void)(0)

Check warning

Code scanning / Cppcheck (reported by Codacy)

misra violation 2101 with no text in the supplied rule-texts-file Warning

misra violation 2101 with no text in the supplied rule-texts-file
#define _Z_ERROR(...) (void)(0)

Check warning

Code scanning / Cppcheck (reported by Codacy)

misra violation 2101 with no text in the supplied rule-texts-file Warning

misra violation 2101 with no text in the supplied rule-texts-file

#else // ZENOH_DEBUG != 0 || defined(Z_BUILD_DEBUG)

#elif (ZENOH_DEBUG == 2)
#define _Z_DEBUG(x, ...) (void)(0)
#define _Z_DEBUG_CONTINUE(x, ...) (void)(0);
#define _Z_INFO(x, ...) \
_Z_LOG_PREFIX(INFO); \
printf(x, ##__VA_ARGS__);
#define _Z_INFO_CONTINUE(x, ...) printf(x, ##__VA_ARGS__);
#define _Z_ERROR(x, ...) \
_Z_LOG_PREFIX(ERROR); \
printf(x, ##__VA_ARGS__);
#define _Z_ERROR_CONTINUE(x, ...) printf(x, ##__VA_ARGS__);
#define _Z_DEBUG(...) \

Check warning

Code scanning / Cppcheck (reported by Codacy)

misra violation 2101 with no text in the supplied rule-texts-file Warning

misra violation 2101 with no text in the supplied rule-texts-file
do { \
if (ZENOH_DEBUG >= _Z_LOG_LVL_DEBUG) { \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why to do this check at runtime, instead of at compile time as before?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually it transitions from a pre-compiler thing to a compile time check, as the compiler realises this values won't change for the whole execution of the program, a bit like a C++ constexpr. But just to be extra sure I added the (void)(0) in release mode and no debug, in case some exotic compiler emits run time checks.

The problem with pre compiler stuff is that it doesn't check if the code is valid while the compiler do. So let's say in my log statement I print a variable, that is then changed (type or name), it will go unnoticed until the compiler sees it, so if I only compile without Debug it won't see it. Now it will always see this kind of issues.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if it is already in place, but having compilation tests for both debug and release seems a simpler option.

_Z_LOG_PREFIX(DEBUG); \
printf(__VA_ARGS__); \
printf("\n"); \
} \
} while (false)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the reason for this do..while if the loop only executes once?

Copy link
Contributor Author

@jean-roland jean-roland Dec 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It turns the block into a single statement and forces a ; after the macro. If you want more info on this: https://stackoverflow.com/questions/4674480/do-whilefalse-pattern

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If MISRA-C is still followed for the codebase, this shall not be required.
But I get the point...


#elif (ZENOH_DEBUG == 1)
#define _Z_DEBUG(x, ...) (void)(0)
#define _Z_DEBUG_CONTINUE(x, ...) (void)(0);
#define _Z_INFO(x, ...) (void)(0);
#define _Z_INFO_CONTINUE(x, ...) (void)(0);
#define _Z_ERROR(x, ...) \
_Z_LOG_PREFIX(ERROR); \
printf(x, ##__VA_ARGS__);
#define _Z_ERROR_CONTINUE(x, ...) printf(x, ##__VA_ARGS__);
#define _Z_INFO(...) \

Check warning

Code scanning / Cppcheck (reported by Codacy)

misra violation 2101 with no text in the supplied rule-texts-file Warning

misra violation 2101 with no text in the supplied rule-texts-file
do { \
if (ZENOH_DEBUG >= _Z_LOG_LVL_INFO) { \
jean-roland marked this conversation as resolved.
Show resolved Hide resolved
_Z_LOG_PREFIX(INFO); \
printf(__VA_ARGS__); \
printf("\n"); \
} \
} while (false)
jean-roland marked this conversation as resolved.
Show resolved Hide resolved

#elif (ZENOH_DEBUG == 0)
#define _Z_DEBUG(x, ...) (void)(0)
#define _Z_INFO(x, ...) (void)(0)
#define _Z_ERROR(x, ...) (void)(0)
#endif
#define _Z_ERROR(...) \

Check warning

Code scanning / Cppcheck (reported by Codacy)

misra violation 2101 with no text in the supplied rule-texts-file Warning

misra violation 2101 with no text in the supplied rule-texts-file
do { \
if (ZENOH_DEBUG >= _Z_LOG_LVL_ERROR) { \
jean-roland marked this conversation as resolved.
Show resolved Hide resolved
_Z_LOG_PREFIX(ERROR); \
printf(__VA_ARGS__); \
printf("\n"); \
} \
} while (false)
jean-roland marked this conversation as resolved.
Show resolved Hide resolved
#endif // ZENOH_DEBUG == 0 && !defined(Z_BUILD_DEBUG)

#endif /* ZENOH_PICO_UTILS_LOGGING_H */
#endif // ZENOH_PICO_UTILS_LOGGING_H
2 changes: 1 addition & 1 deletion src/net/primitives.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ uint16_t _z_declare_resource(_z_session_t *zn, _z_keyexpr_t keyexpr) {

int8_t _z_undeclare_resource(_z_session_t *zn, uint16_t rid) {
int8_t ret = _Z_RES_OK;
_Z_DEBUG("Undeclaring local keyexpr %d\n", rid);
_Z_DEBUG("Undeclaring local keyexpr %d", rid);
_z_resource_t *r = _z_get_resource_by_id(zn, _Z_KEYEXPR_MAPPING_LOCAL, rid);
if (r != NULL) {
// Build the declare message to send on the wire
Expand Down
4 changes: 2 additions & 2 deletions src/net/session.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,12 @@ int8_t _z_open(_z_session_t *zn, _z_config_t *config) {
break;
}
} else {
_Z_ERROR("Trying to configure an invalid mode.\n");
_Z_ERROR("Trying to configure an invalid mode.");
}
}
_z_str_array_clear(&locators);
} else {
_Z_ERROR("A valid config is missing.\n");
_Z_ERROR("A valid config is missing.");
ret = _Z_ERR_GENERIC;
}

Expand Down
6 changes: 3 additions & 3 deletions src/protocol/codec.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ int8_t _z_uint8_decode(uint8_t *u8, _z_zbuf_t *zbf) {
if (_z_zbuf_can_read(zbf) == true) {
*u8 = _z_zbuf_read(zbf);
} else {
_Z_DEBUG("WARNING: Not enough bytes to read\n");
_Z_DEBUG("WARNING: Not enough bytes to read");
ret |= _Z_ERR_MESSAGE_DESERIALIZATION_FAILED;
}

Expand Down Expand Up @@ -322,7 +322,7 @@ int8_t _z_bytes_val_decode_na(_z_bytes_t *bs, _z_zbuf_t *zbf) {
*bs = _z_bytes_wrap(_z_zbuf_get_rptr(zbf), bs->len); // Decode without allocating
_z_zbuf_set_rpos(zbf, _z_zbuf_get_rpos(zbf) + bs->len); // Move the read position
} else {
_Z_DEBUG("WARNING: Not enough bytes to read\n");
_Z_DEBUG("WARNING: Not enough bytes to read");
bs->len = 0;
bs->start = NULL;
ret |= _Z_ERR_MESSAGE_DESERIALIZATION_FAILED;
Expand Down Expand Up @@ -372,7 +372,7 @@ int8_t _z_str_decode(char **str, _z_zbuf_t *zbf) {
}
*str = tmp;
} else {
_Z_DEBUG("WARNING: Not enough bytes to read\n");
_Z_DEBUG("WARNING: Not enough bytes to read");
*str = NULL;
ret |= _Z_ERR_MESSAGE_DESERIALIZATION_FAILED;
}
Expand Down
15 changes: 7 additions & 8 deletions src/protocol/codec/ext.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ int8_t _z_msg_ext_encode(_z_wbuf_t *wbf, const _z_msg_ext_t *ext, _Bool has_next
} break;

default: {
_Z_DEBUG("WARNING: Trying to copy message extension with unknown encoding(%d)\n", enc);
_Z_DEBUG("WARNING: Trying to copy message extension with unknown encoding(%d)", enc);
} break;
}

Expand All @@ -114,7 +114,7 @@ int8_t _z_msg_ext_unknown_body_decode(_z_msg_ext_body_t *body, uint8_t enc, _z_z
} break;

default: {
_Z_DEBUG("WARNING: Trying to copy message extension with unknown encoding(%d)\n", enc);
_Z_DEBUG("WARNING: Trying to copy message extension with unknown encoding(%d)", enc);
} break;
}

Expand Down Expand Up @@ -171,12 +171,11 @@ int8_t _z_msg_ext_unknown_error(_z_msg_ext_t *extension, uint8_t trace_id) {
#if (ZENOH_DEBUG >= 1)
switch (_Z_EXT_ENC(extension->_header)) {
case _Z_MSG_EXT_ENC_UNIT: {
_Z_ERROR("Unknown mandatory extension found (extension_id: %02x, trace_id: %02x), UNIT\n", ext_id,
trace_id);
_Z_ERROR("Unknown mandatory extension found (extension_id: %02x, trace_id: %02x), UNIT", ext_id, trace_id);
break;
}
case _Z_MSG_EXT_ENC_ZINT: {
_Z_ERROR("Unknown mandatory extension found (extension_id: %02x, trace_id: %02x), ZINT(%02jx)\n", ext_id,
_Z_ERROR("Unknown mandatory extension found (extension_id: %02x, trace_id: %02x), ZINT(%02jx)", ext_id,
trace_id, (uintmax_t)extension->_body._zint._val);
break;
}
Expand All @@ -186,14 +185,14 @@ int8_t _z_msg_ext_unknown_error(_z_msg_ext_t *extension, uint8_t trace_id) {
for (size_t i = 0; i < buf.len; ++i) {
snprintf(hex + 2 * i, 3, "%02x", buf.start[i]);
}
_Z_ERROR("Unknown mandatory extension found (extension_id: %02x, trace_id: %02x), ZBUF(%.*s)\n", ext_id,
_Z_ERROR("Unknown mandatory extension found (extension_id: %02x, trace_id: %02x), ZBUF(%.*s)", ext_id,
trace_id, (int)buf.len * 2, hex);
z_free(hex);
break;
}
default: {
_Z_ERROR("Unknown mandatory extension found (extension_id: %02x, trace_id: %02x), UNKOWN_ENCODING\n",
ext_id, trace_id);
_Z_ERROR("Unknown mandatory extension found (extension_id: %02x, trace_id: %02x), UNKOWN_ENCODING", ext_id,
trace_id);
}
}
#endif
Expand Down
30 changes: 15 additions & 15 deletions src/protocol/codec/message.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@
/*------------------ Payload field ------------------*/
int8_t _z_payload_encode(_z_wbuf_t *wbf, const _z_bytes_t *pld) {
int8_t ret = _Z_RES_OK;
_Z_DEBUG("Encoding _PAYLOAD\n");
_Z_DEBUG("Encoding _PAYLOAD");
ret |= _z_bytes_encode(wbf, pld);

return ret;
}

int8_t _z_payload_decode_na(_z_bytes_t *pld, _z_zbuf_t *zbf) {
_Z_DEBUG("Decoding _PAYLOAD\n");
_Z_DEBUG("Decoding _PAYLOAD");
return _z_bytes_decode(pld, zbf);
}

Expand Down Expand Up @@ -84,7 +84,7 @@ int8_t _z_id_decode_as_zbytes(_z_id_t *id, _z_zbuf_t *zbf) {
/*------------------ Timestamp Field ------------------*/
int8_t _z_timestamp_encode(_z_wbuf_t *wbf, const _z_timestamp_t *ts) {
int8_t ret = _Z_RES_OK;
_Z_DEBUG("Encoding _TIMESTAMP\n");
_Z_DEBUG("Encoding _TIMESTAMP");

_Z_RETURN_IF_ERR(_z_uint64_encode(wbf, ts->time))
ret |= _z_id_encode_as_zbytes(wbf, &ts->id);
Expand All @@ -97,7 +97,7 @@ int8_t _z_timestamp_encode_ext(_z_wbuf_t *wbf, const _z_timestamp_t *ts) {
}

int8_t _z_timestamp_decode(_z_timestamp_t *ts, _z_zbuf_t *zbf) {
_Z_DEBUG("Decoding _TIMESTAMP\n");
_Z_DEBUG("Decoding _TIMESTAMP");
int8_t ret = _Z_RES_OK;

ret |= _z_uint64_decode(&ts->time, zbf);
Expand All @@ -109,7 +109,7 @@ int8_t _z_timestamp_decode(_z_timestamp_t *ts, _z_zbuf_t *zbf) {
/*------------------ ResKey Field ------------------*/
int8_t _z_keyexpr_encode(_z_wbuf_t *wbf, _Bool has_suffix, const _z_keyexpr_t *fld) {
int8_t ret = _Z_RES_OK;
_Z_DEBUG("Encoding _RESKEY\n");
_Z_DEBUG("Encoding _RESKEY");

_Z_RETURN_IF_ERR(_z_zint_encode(wbf, fld->_id))
if (has_suffix == true) {
Expand All @@ -120,7 +120,7 @@ int8_t _z_keyexpr_encode(_z_wbuf_t *wbf, _Bool has_suffix, const _z_keyexpr_t *f
}

int8_t _z_keyexpr_decode(_z_keyexpr_t *ke, _z_zbuf_t *zbf, _Bool has_suffix) {
_Z_DEBUG("Decoding _RESKEY\n");
_Z_DEBUG("Decoding _RESKEY");
int8_t ret = _Z_RES_OK;

ret |= _z_zint16_decode(&ke->_id, zbf);
Expand All @@ -144,7 +144,7 @@ int8_t _z_keyexpr_decode(_z_keyexpr_t *ke, _z_zbuf_t *zbf, _Bool has_suffix) {
/*------------------ Locators Field ------------------*/
int8_t _z_locators_encode(_z_wbuf_t *wbf, const _z_locator_array_t *la) {
int8_t ret = _Z_RES_OK;
_Z_DEBUG("Encoding _LOCATORS\n");
_Z_DEBUG("Encoding _LOCATORS");
_Z_RETURN_IF_ERR(_z_zint_encode(wbf, la->_len))
for (size_t i = 0; i < la->_len; i++) {
char *s = _z_locator_to_str(&la->_val[i]);
Expand All @@ -156,7 +156,7 @@ int8_t _z_locators_encode(_z_wbuf_t *wbf, const _z_locator_array_t *la) {
}

int8_t _z_locators_decode_na(_z_locator_array_t *a_loc, _z_zbuf_t *zbf) {
_Z_DEBUG("Decoding _LOCATORS\n");
_Z_DEBUG("Decoding _LOCATORS");
int8_t ret = _Z_RES_OK;

_z_zint_t len = 0; // Number of elements in the array
Expand Down Expand Up @@ -453,7 +453,7 @@ int8_t _z_query_decode_extensions(_z_msg_ext_t *extension, void *ctx) {
}

int8_t _z_query_decode(_z_msg_query_t *msg, _z_zbuf_t *zbf, uint8_t header) {
_Z_DEBUG("Decoding _Z_MID_Z_QUERY\n");
_Z_DEBUG("Decoding _Z_MID_Z_QUERY");
*msg = (_z_msg_query_t){0};
msg->_ext_consolidation = Z_CONSOLIDATION_MODE_AUTO;
int8_t ret = _Z_RES_OK;
Expand Down Expand Up @@ -732,7 +732,7 @@ int8_t _z_pull_decode(_z_msg_pull_t *pull, _z_zbuf_t *zbf, uint8_t header) {
int8_t _z_scout_encode(_z_wbuf_t *wbf, uint8_t header, const _z_s_msg_scout_t *msg) {
int8_t ret = _Z_RES_OK;
(void)(header);
_Z_DEBUG("Encoding _Z_MID_SCOUT\n");
_Z_DEBUG("Encoding _Z_MID_SCOUT");

_Z_RETURN_IF_ERR(_z_uint8_encode(wbf, msg->_version))

Expand All @@ -753,7 +753,7 @@ int8_t _z_scout_encode(_z_wbuf_t *wbf, uint8_t header, const _z_s_msg_scout_t *m
int8_t _z_scout_decode(_z_s_msg_scout_t *msg, _z_zbuf_t *zbf, uint8_t header) {
int8_t ret = _Z_RES_OK;
(void)(header);
_Z_DEBUG("Decoding _Z_MID_SCOUT\n");
_Z_DEBUG("Decoding _Z_MID_SCOUT");
*msg = (_z_s_msg_scout_t){0};

ret |= _z_uint8_decode(&msg->_version, zbf);
Expand All @@ -773,7 +773,7 @@ int8_t _z_scout_decode(_z_s_msg_scout_t *msg, _z_zbuf_t *zbf, uint8_t header) {
/*------------------ Hello Message ------------------*/
int8_t _z_hello_encode(_z_wbuf_t *wbf, uint8_t header, const _z_s_msg_hello_t *msg) {
int8_t ret = _Z_RES_OK;
_Z_DEBUG("Encoding _Z_MID_HELLO\n");
_Z_DEBUG("Encoding _Z_MID_HELLO");

_Z_RETURN_IF_ERR(_z_uint8_encode(wbf, msg->_version))
uint8_t zidlen = _z_id_len(msg->_zid);
Expand All @@ -791,7 +791,7 @@ int8_t _z_hello_encode(_z_wbuf_t *wbf, uint8_t header, const _z_s_msg_hello_t *m
}

int8_t _z_hello_decode_na(_z_s_msg_hello_t *msg, _z_zbuf_t *zbf, uint8_t header) {
_Z_DEBUG("Decoding _Z_MID_HELLO\n");
_Z_DEBUG("Decoding _Z_MID_HELLO");
int8_t ret = _Z_RES_OK;
*msg = (_z_s_msg_hello_t){0};

Expand Down Expand Up @@ -841,7 +841,7 @@ int8_t _z_scouting_message_encode(_z_wbuf_t *wbf, const _z_scouting_message_t *m
} break;

default: {
_Z_DEBUG("WARNING: Trying to encode session message with unknown ID(%d)\n", _Z_MID(msg->_header));
_Z_DEBUG("WARNING: Trying to encode session message with unknown ID(%d)", _Z_MID(msg->_header));
ret |= _Z_ERR_MESSAGE_TRANSPORT_UNKNOWN;
} break;
}
Expand Down Expand Up @@ -870,7 +870,7 @@ int8_t _z_scouting_message_decode_na(_z_scouting_message_t *msg, _z_zbuf_t *zbf)
} break;

default: {
_Z_DEBUG("WARNING: Trying to decode scouting message with unknown ID(0x%x)\n", mid);
_Z_DEBUG("WARNING: Trying to decode scouting message with unknown ID(0x%x)", mid);
ret |= _Z_ERR_MESSAGE_TRANSPORT_UNKNOWN;
is_last = true;
} break;
Expand Down
8 changes: 4 additions & 4 deletions src/protocol/codec/network.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ int8_t _z_request_decode(_z_n_msg_request_t *msg, _z_zbuf_t *zbf, const uint8_t
int8_t _z_response_encode(_z_wbuf_t *wbf, const _z_n_msg_response_t *msg) {
int8_t ret = _Z_RES_OK;
uint8_t header = _Z_MID_N_RESPONSE;
_Z_DEBUG("Encoding _Z_MID_N_RESPONSE\n");
_Z_DEBUG("Encoding _Z_MID_N_RESPONSE");
_Bool has_qos_ext = msg->_ext_qos._val != _Z_N_QOS_DEFAULT._val;
_Bool has_ts_ext = _z_timestamp_check(&msg->_ext_timestamp);
_Bool has_responder_ext = _z_id_check(msg->_ext_responder._zid) || msg->_ext_responder._eid != 0;
Expand Down Expand Up @@ -353,7 +353,7 @@ int8_t _z_response_decode_extension(_z_msg_ext_t *extension, void *ctx) {
}

int8_t _z_response_decode(_z_n_msg_response_t *msg, _z_zbuf_t *zbf, uint8_t header) {
_Z_DEBUG("Decoding _Z_MID_N_RESPONSE\n");
_Z_DEBUG("Decoding _Z_MID_N_RESPONSE");
*msg = (_z_n_msg_response_t){0};
msg->_ext_qos = _Z_N_QOS_DEFAULT;
int8_t ret = _Z_RES_OK;
Expand Down Expand Up @@ -395,7 +395,7 @@ int8_t _z_response_decode(_z_n_msg_response_t *msg, _z_zbuf_t *zbf, uint8_t head
break;
}
default: {
_Z_ERROR("Unknown N_MID: %d\n", _Z_MID(inner_header));
_Z_ERROR("Unknown N_MID: %d", _Z_MID(inner_header));
ret = _Z_ERR_MESSAGE_DESERIALIZATION_FAILED;
}
}
Expand All @@ -405,7 +405,7 @@ int8_t _z_response_decode(_z_n_msg_response_t *msg, _z_zbuf_t *zbf, uint8_t head
/*------------------ Response Final Message ------------------*/
int8_t _z_response_final_encode(_z_wbuf_t *wbf, const _z_n_msg_response_final_t *msg) {
int8_t ret = _Z_RES_OK;
_Z_DEBUG("Encoding _Z_MID_N_RESPONSE\n");
_Z_DEBUG("Encoding _Z_MID_N_RESPONSE");
uint8_t header = _Z_MID_N_RESPONSE_FINAL;
_Z_RETURN_IF_ERR(_z_uint8_encode(wbf, header));
_Z_RETURN_IF_ERR(_z_zint_encode(wbf, msg->_request_id));
Expand Down
Loading
Loading