Skip to content

Update LibRASR: Add lazy logging initialization and explicit init_logging function - #251

Merged
curufinwe merged 12 commits into
masterfrom
librasr_logging_fix
Jul 31, 2026
Merged

Update LibRASR: Add lazy logging initialization and explicit init_logging function#251
curufinwe merged 12 commits into
masterfrom
librasr_logging_fix

Conversation

@SimBe195

Copy link
Copy Markdown
Collaborator

Currently, when librasr is imported in Python, a DummyApplication is created which initializes a channel manager for logging. Since no config files can be passed to librasr at that point yet, the DummyApplication uses an empty config for this and only sets the encoding to "utf-8" (hardcoded). This makes it impossible to configure the channels (e.g. setting unbuffered = yes or similar things). This PR overhauls this mechanism. A pybind function librasr.init_logging(config) is added and instead of creating the channel manager immediately upon import, this is done when either init_logging is called or lazily when logs need to be written. This makes it possible to pass user config for the channel manager like this:

import librasr
config = librasr.Configuration()
config.set_from_file("rasr.config")
librasr.init_logging(config)

if init_logging is 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 initRASR and finiRASR from src/Tools/LibRASR/LibRASR.cc which dont't seem to have a purpose (anymore) and are never called anywhere.

Comment thread src/Core/Application.cc Outdated
Comment thread src/Core/Application.cc Outdated
Co-authored-by: Eugen Beck <curufinwe@users.noreply.github.com>
@curufinwe curufinwe changed the title LibRASR: Delayed logging initialization and explicit init_logging function Update LibRASR: Add lazy logging initialization and explicit init_logging function Jul 24, 2026

@larissakl larissakl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SimBe195 If you have time, could you maybe directly add a short bullet point explaining this in the new documentation (should go under section "Using SearchV2 from Python" -> "Configuration object")?

@SimBe195
SimBe195 changed the base branch from master to searchv2-doc July 24, 2026 15:15
@curufinwe

Copy link
Copy Markdown
Contributor

LGTM, but let's merge only after #250 is merged as you included it in this PR.

Base automatically changed from searchv2-doc to master July 31, 2026 09:32
@curufinwe
curufinwe merged commit c9b3d60 into master Jul 31, 2026
4 checks passed
@curufinwe
curufinwe deleted the librasr_logging_fix branch July 31, 2026 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants