Closed gardner48 closed 5 hours ago
Checkout https://github.com/LLNL/sundials/blob/feature/nls-switching-v7-gs/src/sundials/sundials_logger_impl.h#L35. Now that we have C99 we can change all the logging statements in the code to use a variadic macro and it makes the logging statements much cleaner and gets rid of the repetitive preprocessor checks. My intent was to bring this over from that branch. I can do that here if you think it looks good.
Checkout https://github.com/LLNL/sundials/blob/feature/nls-switching-v7-gs/src/sundials/sundials_logger_impl.h#L35. Now that we have C99 we can change all the logging statements in the code to use a variadic macro and it makes the logging statements much cleaner and gets rid of the repetitive preprocessor checks. My intent was to bring this over from that branch. I can do that here if you think it looks good.
I was going to ask if you still had the variadic macros from the original logging implementation on another branch. I think switching over to those would be great.
It would also be nice to have an "If" version of the macros i.e., something like SUNLogInfoIf
that takes an additional boolean input to change cases like
#if SUNDIALS_LOGGING_LEVEL >= SUNDIALS_LOGGING_INFO
if (kflag != ARK_SUCCESS)
{
SUNLogInfo(ARK_LOGGER, __func__, "end-step-attempt", "status = failed solve, kflag = %i", kflag);
}
#endif
into something like
SUNLogInfoIf(kflag != ARK_SUCCESS, ARK_LOGGER __func__, "end-step-attempt", "status = failed solve, kflag = %i", kflag);
@gardner48 The "if" version sounds like a nice addition as well.
1. Add the integer values that correspond with each logging level (`SUN_LOGLEVEL_ALL`, `SUN_LOGLEVEL_NONE`, ...). Currently, users are asked for a numerical logging level value by CMake, which can only be found hidden inside `include/sundials/sundials_logger.h`.
The logging documentation directs users to the documentation for the CMake option here which lists the numeric values and associated logging level.
2. The end of this file has an incredibly brief section on "Example Usage" for the logger. Could you add a few step-by-step "case studies" showing how a user could * configure SUNDIALS with an "appropriate" logging level * set environment variables to hold the "relevant" log file(s) * run an existing SUNDIALS example * use one of `tools/log_example.py` or `tools/log_example_mri.py`, e.g., to plot the step size history as a function of time.
I'll update that section with additional information shortly.
The logging statements in all the ARKODE steppers have been updated now and CI tests added for each
Follow on to utilities added in #499