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

Version API #612

Closed
andysCaplin opened this issue Jul 30, 2020 · 2 comments · Fixed by #657
Closed

Version API #612

andysCaplin opened this issue Jul 30, 2020 · 2 comments · Fixed by #657

Comments

@andysCaplin
Copy link

Hazelcast Cpp client version: 3.12

Is there an API to query the library version ? I can't find one in the headers.

Nearest I can find is the BuildInfo class but when I tried to use the API in that I get a crash.

@ihsandemir
Copy link
Collaborator

Hello @andysCaplin we currently do not provide a public API to provide the client version but it is really being kept inside the logger as private member: https://github.com/hazelcast/hazelcast-cpp-client/blob/v3.12/hazelcast/include/hazelcast/util/ILogger.h#L89 and it is being printed for all the log statements. We provide this parameter to cmake during the build process as a definition here: https://github.com/hazelcast/hazelcast-cpp-client/blob/v3.12/CMakeLists.txt#L39 and pass this to the logger.

The API can be added very easily. I am putting it to 4.0 release milestone as a feature request.

Well, you can do a work around to obtain the version by parsing the log line. The client always prints logs on startup, you can obtain the stdout stream (by redirecting to example stringstream https://stackoverflow.com/questions/5419356/redirect-stdout-stderr-to-a-string) and parse it to get the version string.

@andysCaplin
Copy link
Author

Thank you.

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

Successfully merging a pull request may close this issue.

2 participants