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

[Feature] Output logging in rendered output #18

Closed
eddiebergman opened this issue Apr 20, 2023 · 2 comments
Closed

[Feature] Output logging in rendered output #18

eddiebergman opened this issue Apr 20, 2023 · 2 comments

Comments

@eddiebergman
Copy link

Is your feature request related to a problem? Please describe.
I am using markdown_exec to have examples which are also run and show their output. Part of this would be nice to display the logging output too.

Describe the solution you'd like
An annotation similar to exec=True except you specify the logging level, i.e. logs=INFO.

Describe alternatives you've considered
I previously injected hidden code into the code blocks that would take the buffer that you overwrite the print builtin with and set this to the outstream of rich.print. I could do something similar for logging but I would prefer not to rely on private functionality.

I recently did so with sessions, injecting in session["__name__"] = "__main__" to run the example script's __main__ block, as well as try solve issues to pickling that occur when using markdown exec but to no avail. A recent PR changed the name of the global variable so it was a good lesson not to rely on the private functionality.

Additional context
The logging from the running examples actually gets streamed to the session running mkdocs --serve which pollutes the build output. It would be good to redirect this anywho.

@pawamoy
Copy link
Owner

pawamoy commented Apr 23, 2023

Hey @eddiebergman, thanks for the feature request.

How do your scripts/examples configure logging? I'm not against a logs option which defaults to None and that, when provided a log level, redirect all logs to our buffer, keeping only the ones with a level greater or equal the specified one.

@pawamoy
Copy link
Owner

pawamoy commented Jun 13, 2024

Lack of info, closing for now.

@pawamoy pawamoy closed this as not planned Won't fix, can't repro, duplicate, stale Jun 13, 2024
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

No branches or pull requests

2 participants