Closed Q-Minh closed 1 year ago
Hi @Q-Minh
Thanks, I understand. I will keep this issue open so that I look into it soon.
If I may suggest one approach, you could define a preprocessor directive in the CMakeLists.txt
such as MC_DISABLE_LOG_MSG
so that users of your library can explicitly turn it on if they wish to via set(MC_DISABLE_LOG_MSG ON)
. Then, in the library's sources, you can define the log_msg
macro conditionally, i.e.
#ifndef MC_DISABLE_LOG_MSG
// Define log_msg macro as usual
// ...
#else
// Define log_msg macro as no-op
// ...
#endif
This way, you don't need to change any of the implementation/interface code.
Thanks for the suggestion.
Also consider adding additional control flags into mcDebugMessageControl, for supressing all mesaages.
Hi @Q-Minh ,
This is now resolved (pull latest commit from mster).
@Justpenz233 You can already do this by:
// ....
McSize numBytes = 0;
McFlags contextFlags;
api_err = mcGetInfo(context, MC_CONTEXT_FLAGS, 0, nullptr, &numBytes);
api_err = mcGetInfo(context, MC_CONTEXT_FLAGS, numBytes, &contextFlags, nullptr);
if (contextFlags & MC_DEBUG) {
mcDebugMessageCallback(context, mcDebugOutput, nullptr);
mcDebugMessageControl(context, McDebugSource::MC_DEBUG_SOURCE_ALL,
McDebugType::MC_DEBUG_TYPE_ALL,
McDebugSeverity::MC_DEBUG_SEVERITY_ALL,
false); // <---- here is what you want
}
// ....
Hi,
Thank you so much for this amazing library, the code is very well designed (very similar to CUDA APIs!) and the features are incredibly useful. I've tried out various of MCUT's features on a limited set of inputs, and they work as expected. However, I noticed that the
log_msg
macro is used throughout the internal implementations with noquiet
mode or filtering option. Would it be possible to silence the logs, as outputting and flushing things to the console is problematic for performance and usability in other code bases?Thank you so much again!