capi: allow printing calls on stderr#388
Draft
VDanielEdwards wants to merge 2 commits into
Draft
Conversation
Signed-off-by: Daniel Edwards <Daniel.Edwards@vector.com>
VDanielEdwards
commented
Jul 8, 2026
|
|
||
| message.clear(); | ||
| message.append(R"({"thread":)"); | ||
| fmt::format_to(std::back_inserter(message), "{}", fmt::streamed(std::this_thread::get_id())); |
Member
Author
There was a problem hiding this comment.
Since the 'textual' version of a std::thread::id isn't neccessarily a number this could produce invalid JSON. Just keep that in mind.
Signed-off-by: Daniel Edwards <Daniel.Edwards@vector.com>
Collaborator
|
Yeah, the possible struct version mismatch is a real ABI nightmare. i need to digest this a bit, and play around with it |
MariusBgm
reviewed
Jul 9, 2026
|
|
||
| } // namespace VSilKit | ||
|
|
||
| #define VSILKIT_API_TRACE(...) ::VSilKit::ApiTraceEvent((__func__), __VA_ARGS__) |
Collaborator
There was a problem hiding this comment.
func is an implementation defined string, so the traces are tied to the current OS/compiler.
std::source_location would be nice...
Member
Author
There was a problem hiding this comment.
__func__ is actually standard C99. For functions with C linkage (like the C-API) it is also consistently the function name. See cppreference.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Subject
Exploring how to 'log' / 'trace' / ... C-API calls. This just prints the arguments and some results / errors on
stderr.Notes and issues:
How do we deal with any
pointer-to-structtype arguments (e.g.,SilKit_CanFrame *)?How do we deal with returns and the out-pointers?
Example Output
From
SilKitCanReader:From
SilKitCanWriter: