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

Allow custom loggers #652

Open
aragilar opened this issue Jan 25, 2025 · 1 comment
Open

Allow custom loggers #652

aragilar opened this issue Jan 25, 2025 · 1 comment

Comments

@aragilar
Copy link

It looks like as part of the refactoring around logging/error handling, the option of being able to specify a function to control where logs go has disappeared. Currently, you can just set a filename to use, whereas previously you could tie it into other logging systems (e.g. Python's logging), or just drop the logs as needed (which you can sort-of do now by configuring the logfile as /dev/null). Would it be possible to have a logging version of https://sundials.readthedocs.io/en/latest/sundials/Errors_link.html#c.SUNErrHandlerFn (which appears not to be called for lower priority logs)?

@balos1
Copy link
Member

balos1 commented Jan 27, 2025

It looks like as part of the refactoring around logging/error handling, the option of being able to specify a function to control where logs go has disappeared.

Previously, only KINSOL had a capability to separately provide callback functions for output that was lower priority than "error" level output (it had a separate callback for "error" output and "info" output). The other packages had "warning" and "error" messages, but they would both go to the same file, or through the same error handler function. We have added the capability (and corresponding messages) for more levels of logging output now that did not previously exist.

I suppose with the changes, two functionalities were lost: 1) if using KINSOL, there is no longer a way to specify a callback for info level output 2) warning level output no longer goes through a callback (since it was separated from the error level). I think we should at least restore those functionalities.

Would it be possible to have a logging version of https://sundials.readthedocs.io/en/latest/sundials/Errors_link.html#c.SUNErrHandlerFn (which appears not to be called for lower priority logs)?

So you would like to be able to provide a callback function for each level of logging output? I.e., one for errors, warnings, info, and debugging?

I think making it possible to provide a custom SUNLogger implementation would probably provide all the functionality you need.

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

No branches or pull requests

2 participants