Skip to content

Commit

Permalink
Use open62541 logging mechanisms.
Browse files Browse the repository at this point in the history
  • Loading branch information
aentinger committed May 22, 2024
1 parent ff647bf commit b6fa5fe
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions examples/opcUA_server/opcUA_server.ino
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,11 @@ void setup()
the_answer);
if (UA_StatusCode_isBad(rc))
{
char msg[32] = {0};
snprintf(msg, sizeof(msg), "add_variable(..., the_answer) failed with %s", UA_StatusCode_name(rc));
Serial.println(msg);
UA_ServerConfig * config = UA_Server_getConfig(opc_ua_server);
UA_LOG_ERROR(config->logging,
UA_LOGCATEGORY_SERVER,
"add_variable(..., the_answer) failed with %s",
UA_StatusCode_name(rc));
}

bool const relay_1_active = false;
Expand All @@ -225,9 +227,11 @@ void setup()
relay_1_active);
if (UA_StatusCode_isBad(rc))
{
char msg[32] = {0};
snprintf(msg, sizeof(msg), "add_variable(..., relay_1_active) failed with %s", UA_StatusCode_name(rc));
Serial.println(msg);
UA_ServerConfig * config = UA_Server_getConfig(opc_ua_server);
UA_LOG_ERROR(config->logging,
UA_LOGCATEGORY_SERVER,
"add_variable(..., relay_1_active) failed with %s",
UA_StatusCode_name(rc));
}

/* Print some threading related message. */
Expand Down

0 comments on commit b6fa5fe

Please sign in to comment.