Skip to content

Commit

Permalink
RDKBDEV-2901 : Changed the json logging from JSON_C_TO_STRING_PRETTY …
Browse files Browse the repository at this point in the history
…to JSON_C_TO_STRING_SPACED

Reason for change:
Optimize the logging in a single line format using JSON_C_TO_STRING_SPACED to
reduce white space and better suited for log processing.

Test Procedure: verify rdklogs in DSLManager.
Risks: None.

Signed-off-by: K Sanjay Nayak <[email protected]>
  • Loading branch information
sanjaynayakk committed Oct 17, 2024
1 parent cdd7521 commit 133a03c
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions source/TR-181/integration_src.shared/xdsl_hal.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ int xdsl_hal_dslGetLineEnable( hal_param_t *req_param )
return RETURN_ERR;
}

CcspTraceInfo(("%s-%d: JSON Request message = %s \n", __FUNCTION__, __LINE__, json_object_to_json_string_ext(jmsg, JSON_C_TO_STRING_PRETTY)));
CcspTraceInfo(("%s-%d: JSON Request message = %s \n", __FUNCTION__, __LINE__, json_object_to_json_string_ext(jmsg, JSON_C_TO_STRING_SPACED)));

if( json_hal_client_send_and_get_reply(jmsg, &jresponse_msg) != RETURN_OK)
{
Expand Down Expand Up @@ -336,7 +336,7 @@ int xdsl_hal_dslGetLineStandardUsed( hal_param_t *req_param, int line_index)
return RETURN_ERR;
}

CcspTraceInfo(("%s-%d: JSON Request message = %s \n", __FUNCTION__, __LINE__, json_object_to_json_string_ext(jmsg, JSON_C_TO_STRING_PRETTY)));
CcspTraceInfo(("%s-%d: JSON Request message = %s \n", __FUNCTION__, __LINE__, json_object_to_json_string_ext(jmsg, JSON_C_TO_STRING_SPACED)));

if( json_hal_client_send_and_get_reply(jmsg, &jresponse_msg) != RETURN_OK)
{
Expand Down Expand Up @@ -382,7 +382,7 @@ int xdsl_hal_dslSetLineEnable( hal_param_t *req_msg )
CHECK(jmsg);

json_hal_add_param(jmsg, SET_REQUEST_MESSAGE, req_msg);
CcspTraceInfo(("%s-%d: JSON Request message = %s \n", __FUNCTION__, __LINE__, json_object_to_json_string_ext(jmsg, JSON_C_TO_STRING_PRETTY)));
CcspTraceInfo(("%s-%d: JSON Request message = %s \n", __FUNCTION__, __LINE__, json_object_to_json_string_ext(jmsg, JSON_C_TO_STRING_SPACED)));

if( json_hal_client_send_and_get_reply(jmsg, &jreply_msg) != RETURN_OK)
{
Expand Down Expand Up @@ -439,7 +439,7 @@ int xdsl_hal_dslSetLineEnableDataGathering(hal_param_t *req_msg)
return RETURN_ERR;
}

CcspTraceInfo(("%s-%d: JSON Request message = %s \n", __FUNCTION__, __LINE__, json_object_to_json_string_ext(jmsg, JSON_C_TO_STRING_PRETTY)));
CcspTraceInfo(("%s-%d: JSON Request message = %s \n", __FUNCTION__, __LINE__, json_object_to_json_string_ext(jmsg, JSON_C_TO_STRING_SPACED)));
if( json_hal_client_send_and_get_reply(jmsg, &jreply_msg) != RETURN_OK )
{
CcspTraceInfo(("[%s][%d] RPC message failed \n", __FUNCTION__, __LINE__));
Expand Down Expand Up @@ -796,7 +796,7 @@ int xdsl_hal_dslGetLineInfo(int lineNo, PDML_XDSL_LINE pstLineInfo)
return RETURN_ERR;
}

CcspTraceInfo(("%s-%d: JSON Request message = %s \n", __FUNCTION__, __LINE__, json_object_to_json_string_ext(jmsg, JSON_C_TO_STRING_PRETTY)));
CcspTraceInfo(("%s-%d: JSON Request message = %s \n", __FUNCTION__, __LINE__, json_object_to_json_string_ext(jmsg, JSON_C_TO_STRING_SPACED)));
if (json_hal_client_send_and_get_reply(jmsg, &jreply_msg) != RETURN_OK )
{
CcspTraceError(("[%s][%d] RPC message failed \n", __FUNCTION__, __LINE__));
Expand All @@ -810,7 +810,7 @@ int xdsl_hal_dslGetLineInfo(int lineNo, PDML_XDSL_LINE pstLineInfo)
return RETURN_ERR;
}

CcspTraceDebug(("JSON Response message = %s \n", json_object_to_json_string_ext(jreply_msg,JSON_C_TO_STRING_PRETTY)));
CcspTraceDebug(("JSON Response message = %s \n", json_object_to_json_string_ext(jreply_msg, JSON_C_TO_STRING_SPACED)));

if (json_object_object_get_ex(jreply_msg, JSON_RPC_FIELD_PARAMS, &jparams))
{
Expand Down Expand Up @@ -1128,15 +1128,15 @@ ANSC_STATUS xtm_hal_getLinkInfo(int lineNo, PDML_PTM pPtmLink)
return RETURN_ERR;
}

CcspTraceInfo(("%s-%d: JSON Request message = %s \n", __FUNCTION__, __LINE__, json_object_to_json_string_ext(jrequest, JSON_C_TO_STRING_PRETTY)));
CcspTraceInfo(("%s-%d: JSON Request message = %s \n", __FUNCTION__, __LINE__, json_object_to_json_string_ext(jrequest, JSON_C_TO_STRING_SPACED)));

if (json_hal_client_send_and_get_reply(jrequest, &jreply_msg) == RETURN_ERR)
{
CcspTraceError(("%s - %d Failed to get reply for the json request \n", __FUNCTION__, __LINE__));
return ANSC_STATUS_FAILURE;
}

CcspTraceInfo(("%s-%d: JSON Response message = %s \n", __FUNCTION__, __LINE__, json_object_to_json_string_ext(jreply_msg,JSON_C_TO_STRING_PRETTY)));
CcspTraceInfo(("%s-%d: JSON Response message = %s \n", __FUNCTION__, __LINE__, json_object_to_json_string_ext(jreply_msg, JSON_C_TO_STRING_SPACED)));

rc = get_ptm_link_info(jreply_msg, pPtmLink);
if (rc != ANSC_STATUS_SUCCESS)
Expand Down Expand Up @@ -1188,15 +1188,15 @@ ANSC_STATUS atm_hal_getLinkInfo(int lineNo, PDML_ATM pAtmLink)
return RETURN_ERR;
}

CcspTraceInfo(("%s-%d: JSON Request message = %s \n", __FUNCTION__, __LINE__, json_object_to_json_string_ext(jrequest, JSON_C_TO_STRING_PRETTY)));
CcspTraceInfo(("%s-%d: JSON Request message = %s \n", __FUNCTION__, __LINE__, json_object_to_json_string_ext(jrequest, JSON_C_TO_STRING_SPACED)));

if (json_hal_client_send_and_get_reply(jrequest, &jreply_msg) == RETURN_ERR)
{
CcspTraceError(("%s - %d Failed to get reply for the json request \n", __FUNCTION__, __LINE__));
return ANSC_STATUS_FAILURE;
}

CcspTraceInfo(("%s-%d: JSON Response message = %s \n", __FUNCTION__, __LINE__, json_object_to_json_string_ext(jreply_msg,JSON_C_TO_STRING_PRETTY)));
CcspTraceInfo(("%s-%d: JSON Response message = %s \n", __FUNCTION__, __LINE__, json_object_to_json_string_ext(jreply_msg, JSON_C_TO_STRING_SPACED)));

rc = get_atm_link_info(jreply_msg, pAtmLink);
if (rc != ANSC_STATUS_SUCCESS)
Expand Down Expand Up @@ -1411,7 +1411,7 @@ int xdsl_hal_dslGetLineStats(int lineNo, PDML_XDSL_LINE_STATS pstLineStats)
return RETURN_ERR;
}

CcspTraceInfo(("%s-%d: JSON Request message = %s \n", __FUNCTION__, __LINE__, json_object_to_json_string_ext(jmsg, JSON_C_TO_STRING_PRETTY)));
CcspTraceInfo(("%s-%d: JSON Request message = %s \n", __FUNCTION__, __LINE__, json_object_to_json_string_ext(jmsg, JSON_C_TO_STRING_SPACED)));

if( json_hal_client_send_and_get_reply(jmsg, &jreply_msg) != RETURN_OK)
{
Expand Down Expand Up @@ -1713,7 +1713,7 @@ int xdsl_hal_dslGetChannelInfo(int channelNo, PDML_XDSL_CHANNEL pstChannelInfo)
return RETURN_ERR;
}

CcspTraceInfo(("%s-%d: JSON Request message = %s \n", __FUNCTION__, __LINE__, json_object_to_json_string_ext(jmsg, JSON_C_TO_STRING_PRETTY)));
CcspTraceInfo(("%s-%d: JSON Request message = %s \n", __FUNCTION__, __LINE__, json_object_to_json_string_ext(jmsg, JSON_C_TO_STRING_SPACED)));

if( json_hal_client_send_and_get_reply(jmsg, &jreply_msg) != RETURN_OK)
{
Expand Down Expand Up @@ -1867,7 +1867,7 @@ int xdsl_hal_dslGetChannelStats(int channelNo, PDML_XDSL_CHANNEL_STATS pstChanne
return RETURN_ERR;
}

CcspTraceInfo(("%s-%d: JSON Request message = %s \n", __FUNCTION__, __LINE__, json_object_to_json_string_ext(jmsg, JSON_C_TO_STRING_PRETTY)));
CcspTraceInfo(("%s-%d: JSON Request message = %s \n", __FUNCTION__, __LINE__, json_object_to_json_string_ext(jmsg, JSON_C_TO_STRING_SPACED)));

if( json_hal_client_send_and_get_reply(jmsg, &jreply_msg) != RETURN_OK )
{
Expand Down Expand Up @@ -2090,7 +2090,7 @@ int xdsl_hal_dslGetXRdk_Nlm( PDML_XDSL_X_RDK_NLNM pstNlmInfo )
return RETURN_ERR;
}

CcspTraceInfo(("%s-%d: JSON Request message = %s \n", __FUNCTION__, __LINE__, json_object_to_json_string_ext(jmsg, JSON_C_TO_STRING_PRETTY)));
CcspTraceInfo(("%s-%d: JSON Request message = %s \n", __FUNCTION__, __LINE__, json_object_to_json_string_ext(jmsg, JSON_C_TO_STRING_SPACED)));
if( json_hal_client_send_and_get_reply(jmsg, &jreply_msg) != RETURN_OK)
{
CcspTraceError(("[%s][%d] RPC message failed \n", __FUNCTION__, __LINE__));
Expand Down Expand Up @@ -2270,7 +2270,7 @@ static ANSC_STATUS get_link_info(hal_param_t *get_param)
jrequest = create_json_request_message(GET_REQUEST_MESSAGE, get_param->name, NULL_TYPE , NULL);
CHECK(jrequest != NULL);

CcspTraceInfo(("%s - %d Json request message = %s \n", __FUNCTION__, __LINE__, json_object_to_json_string_ext(jrequest, JSON_C_TO_STRING_PRETTY)));
CcspTraceInfo(("%s - %d Json request message = %s \n", __FUNCTION__, __LINE__, json_object_to_json_string_ext(jrequest, JSON_C_TO_STRING_SPACED)));

if (json_hal_client_send_and_get_reply(jrequest, &jreply_msg) == RETURN_ERR)
{
Expand All @@ -2279,7 +2279,7 @@ static ANSC_STATUS get_link_info(hal_param_t *get_param)
}

CHECK(jreply_msg != NULL);
CcspTraceInfo(("Got Json response \n = %s \n", json_object_to_json_string_ext(jreply_msg, JSON_C_TO_STRING_PRETTY)));
CcspTraceInfo(("Got Json response \n = %s \n", json_object_to_json_string_ext(jreply_msg, JSON_C_TO_STRING_SPACED)));

if (json_hal_get_param(jreply_msg, JSON_RPC_PARAM_ARR_INDEX, GET_RESPONSE_MESSAGE, &param) != RETURN_OK)
{
Expand Down Expand Up @@ -2714,7 +2714,7 @@ ANSC_STATUS atm_hal_setLinkInfoParam(PDML_ATM config)
param.type = PARAM_UNSIGNED_INTEGER;
json_hal_add_param(jmsg, SET_REQUEST_MESSAGE, &param);
}
CcspTraceInfo(("%s-%d: JSON Request message = %s \n", __FUNCTION__, __LINE__, json_object_to_json_string_ext(jmsg, JSON_C_TO_STRING_PRETTY)));
CcspTraceInfo(("%s-%d: JSON Request message = %s \n", __FUNCTION__, __LINE__, json_object_to_json_string_ext(jmsg, JSON_C_TO_STRING_SPACED)));

if( json_hal_client_send_and_get_reply(jmsg, &jreply_msg) != RETURN_OK)
{
Expand Down Expand Up @@ -2845,7 +2845,7 @@ ANSC_STATUS atm_hal_startAtmLoopbackDiagnostics(PDML_ATM_DIAG pDiag)
param.type = PARAM_UNSIGNED_INTEGER;
json_hal_add_param(jmsg, SET_REQUEST_MESSAGE, &param);

CcspTraceInfo(("%s-%d: JSON Request message = %s \n", __FUNCTION__, __LINE__, json_object_to_json_string_ext(jmsg, JSON_C_TO_STRING_PRETTY)));
CcspTraceInfo(("%s-%d: JSON Request message = %s \n", __FUNCTION__, __LINE__, json_object_to_json_string_ext(jmsg, JSON_C_TO_STRING_SPACED)));

if( json_hal_client_send_and_get_reply(jmsg, &jreply_msg) != RETURN_OK)
{
Expand Down Expand Up @@ -2878,7 +2878,7 @@ ANSC_STATUS atm_hal_startAtmLoopbackDiagnostics(PDML_ATM_DIAG pDiag)
jmsg = create_json_request_message(GET_REQUEST_MESSAGE, ATM_LINK_DIAGNOSTICS, NULL_TYPE , NULL);
CHECK(jmsg != NULL);

CcspTraceInfo(("%s - %d Json request message = %s \n", __FUNCTION__, __LINE__, json_object_to_json_string_ext(jmsg, JSON_C_TO_STRING_PRETTY)));
CcspTraceInfo(("%s - %d Json request message = %s \n", __FUNCTION__, __LINE__, json_object_to_json_string_ext(jmsg, JSON_C_TO_STRING_SPACED)));

if (json_hal_client_send_and_get_reply(jmsg, &jreply_msg) == RETURN_ERR)
{
Expand All @@ -2887,7 +2887,7 @@ ANSC_STATUS atm_hal_startAtmLoopbackDiagnostics(PDML_ATM_DIAG pDiag)
}

CHECK(jreply_msg != NULL);
CcspTraceInfo(("Got Json response \n = %s \n", json_object_to_json_string_ext(jreply_msg, JSON_C_TO_STRING_PRETTY)));
CcspTraceInfo(("Got Json response \n = %s \n", json_object_to_json_string_ext(jreply_msg, JSON_C_TO_STRING_SPACED)));

total_param_count = json_hal_get_total_param_count(jreply_msg);

Expand Down

0 comments on commit 133a03c

Please sign in to comment.