Update LibRASR: Add lazy logging initialization and explicit init_logging function - #251
Merged
Conversation
# Conflicts: # doc/flf_nodes.rst
curufinwe
requested changes
Jul 24, 2026
Co-authored-by: Eugen Beck <curufinwe@users.noreply.github.com>
init_logging function
Contributor
|
LGTM, but let's merge only after #250 is merged as you included it in this PR. |
curufinwe
approved these changes
Jul 31, 2026
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.
Currently, when
librasris imported in Python, aDummyApplicationis created which initializes a channel manager for logging. Since no config files can be passed to librasr at that point yet, theDummyApplicationuses an empty config for this and only sets the encoding to "utf-8" (hardcoded). This makes it impossible to configure the channels (e.g. settingunbuffered = yesor similar things). This PR overhauls this mechanism. A pybind functionlibrasr.init_logging(config)is added and instead of creating the channel manager immediately upon import, this is done when eitherinit_loggingis called or lazily when logs need to be written. This makes it possible to pass user config for the channel manager like this:if
init_loggingis never called, the behavior stays the same, i.e., as soon as components start logging things, a channel manager is created with default parameters.The PR also removes
initRASRandfiniRASRfrom src/Tools/LibRASR/LibRASR.cc which dont't seem to have a purpose (anymore) and are never called anywhere.