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

Log facilities #690

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Log facilities #690

wants to merge 7 commits into from

Conversation

martinwag
Copy link

this updates PR #371 to the current stack version and adds the ability to set callback and file output per libmodbus instance (ctx)

@cla-bot
Copy link

cla-bot bot commented Mar 14, 2023

We require contributors to sign our Contributor License Agreement. In order for us to review and merge your code, please fill https://forms.gle/5635zjphDo5JEJQSA to get added. Your document will be manually checked by the maintainer. Be patient...

@martinwag
Copy link
Author

any way to get the license agreement without google docs? For me, google docs is blocked on company policy.

@mhei
Copy link
Contributor

mhei commented Mar 14, 2023

I think @stephane could export a PDF version of the Google form which you can then fill, sign and send back via email... On the other hand, does your company policy disallows you to sign this form with a personal/private browser/internet connection?

## Synopsis

```c
void modbus_set_error_user_data(modbus_t *ctx, void* out_user_data);
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these really void* or should they explicitly be FILE * pointers? The names and the examples and the descriptions don't really line up well here.

Copy link
Author

Choose a reason for hiding this comment

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

this is form the original PR. This also was the "usual" way to pass arbitrary data for callback when I last did "C", so I didn't change it.


## Example

```c++
Copy link
Contributor

Choose a reason for hiding this comment

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

As a C library, I think a plain boring C example is more suitable. C++ as well, sure, ifyou think it's important, but I don't think the only example should be c++

Copy link
Author

Choose a reason for hiding this comment

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

It's copy/paste from my application code. Don't have a C example at hand.

## Synopsis

```c
typedef int (*modbus_stream_handler_t)(void *user, const char *format, va_list ap);
Copy link
Contributor

@karlp karlp Mar 15, 2023

Choose a reason for hiding this comment

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

this needs to document the return type, at least. Again, void *user vs FILE * is... muddy here. I know you want void * user for when you have a custom handler, and FILE* magically working when you just set the "user data" without registering a custom handler, but this is... very unclear to people not well versed in these things.

Copy link
Author

Choose a reason for hiding this comment

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

uses printf return type / values. I don't know how to document the void pointer stuff properly, this is a concept you have to understand in order to not make errors...

MODBUS_API int modbus_trace(modbus_t *ctx, const char* format, ...);
MODBUS_API int modbus_vtrace(modbus_t *ctx, const char* format, va_list ap);
MODBUS_API int modbus_trace_error(modbus_t *ctx, const char* format, ...);
MODBUS_API int modbus_vtrace_error(modbus_t *ctx, const char* format, va_list ap);
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these last 4 really part of the api?

Copy link
Author

Choose a reason for hiding this comment

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

those are form the original PR. I have no idea where else to put them / how to make them private. There is no harm if you call them.

@stephane stephane self-assigned this Mar 15, 2023
Copy link

cla-bot bot commented Jul 17, 2024

We require contributors to sign our Contributor License Agreement. In order for us to review and merge your code, please fill https://forms.gle/5635zjphDo5JEJQSA to get added. Your document will be manually checked by the maintainer. Be patient...

Copy link

cla-bot bot commented Jul 17, 2024

We require contributors to sign our Contributor License Agreement. In order for us to review and merge your code, please fill https://forms.gle/5635zjphDo5JEJQSA to get added. Your document will be manually checked by the maintainer. Be patient...

fixes double-free crash in unit-test server/client
Copy link

cla-bot bot commented Jul 17, 2024

We require contributors to sign our Contributor License Agreement. In order for us to review and merge your code, please fill https://forms.gle/5635zjphDo5JEJQSA to get added. Your document will be manually checked by the maintainer. Be patient...

@martinwag
Copy link
Author

I've had a look at the license agreement.

  • i can't grant usage because i don't own the original PR code.
  • this is complex enough for me to not sign it without consulting a lawyer. Sorry, not worth it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants