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

Fix formatting of long log messages #30

Merged
merged 7 commits into from
Jan 23, 2024
Merged

Conversation

uklotzde
Copy link
Collaborator

@uklotzde uklotzde commented Jan 20, 2024

Fixes #29.

@uklotzde
Copy link
Collaborator Author

Requires HMIProject/open62541-sys#10.

@sgoll
Copy link
Contributor

sgoll commented Jan 22, 2024

@uklotzde I published open62541-sys@0.2.2.

@uklotzde uklotzde marked this pull request as ready for review January 22, 2024 14:25
Copy link
Contributor

@sgoll sgoll left a comment

Choose a reason for hiding this comment

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

Seems alright. One difference seems to be that for long messages, the previous code would truncate with "…" inside the largest allowed buffer while the current code now bails out early when working on the small buffer, truncating the message at shorter buffer size than necessary.

You can see the difference with

const FORMAT_MESSAGE_DEFAULT_BUFFER_LEN: usize = 10;
const FORMAT_MESSAGE_MAXIMUM_BUFFER_LEN: usize = 100;

I would expect most messages to have 99 characters but most have only 9.

src/client.rs Outdated Show resolved Hide resolved
src/client.rs Outdated Show resolved Hide resolved
@uklotzde uklotzde requested a review from sgoll January 22, 2024 16:20
@sgoll sgoll merged commit afcac4d into HMIProject:main Jan 23, 2024
5 checks passed
@uklotzde uklotzde deleted the vsnprintf branch January 29, 2024 09:03
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.

Log messages crash execution
2 participants