-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Make logging a proper plugin with state and cleanup method #2263
Conversation
arch/ua_network_tcp.c
Outdated
"Could not create client socket: %s", strerror(UA_ERRNO)); | ||
ClientNetworkLayerTCP_close(connection); | ||
return UA_STATUSCODE_BADDISCONNECT; | ||
UA_LOG_WARNING(UA_Log_Stdout, UA_LOGCATEGORY_NETWORK, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should use logger
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Absolutely.
I would go so far not to include #include "ua_log_stdout.h" here at all.
arch/ua_network_tcp.c
Outdated
ClientNetworkLayerTCP_close(connection); | ||
return UA_STATUSCODE_BADDISCONNECT; | ||
if(UA_socket_set_nonblocking(clientsockfd) != UA_STATUSCODE_GOOD) { | ||
UA_LOG_WARNING(UA_Log_Stdout, UA_LOGCATEGORY_NETWORK, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should use logger
arch/ua_network_tcp.c
Outdated
@@ -634,7 +635,7 @@ UA_StatusCode UA_ClientConnectionTCP_poll(UA_Client *client, void *data) { | |||
if ((error == -1) && (UA_ERRNO != UA_ERR_CONNECTION_PROGRESS)) { | |||
ClientNetworkLayerTCP_close(connection); | |||
UA_LOG_WARNING(UA_Log_Stdout, UA_LOGCATEGORY_NETWORK, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here and in the rest of the file
Couldn't we make the logger a singleton so that we can access it wherever we want to? Might make the logging calls easier as well. Example:
|
Singletons in C are global variables. Especially, global variables that are not a constant are bad... |
d381abc
to
4af545d
Compare
4229a2d
to
fc38655
Compare
@Pro After trying several times, I am unable to find the source of the problem on OSX. Do you have a hunch of how to fix this? |
@jpfr this must be related to the removal of So let's keep my commit in this branch and I will add a new PR which tries to solve the issue with the queue.h. The PR is here: |
No description provided.