Manim-Notebook / manim-notebook

Simple commands to replicate the manim dev workflow in VSCode
MIT License
5 stars 0 forks source link

Init logging mechanism #56

Closed Splines closed 3 days ago

Splines commented 4 days ago

In this PR, we init the Logger class to log to the Manim Notebook output pane in VSCode as well as to a dedicated log file. For users to access this log file, we add a Manim Notebook: Open log file command. I've also included a section in the Readme explaining how to report an issue using this log file.

As I had to search way too long to find the relevant information on how to log in a VSCode extension, I've also written a StackOverflow answer.

A subsequent PR will then add respective Logger.trace() etc. statements at important places in the code.

Known limitations

The line and colon numbers refer to the position in the transpiled .js. I haven't yet bothered about generating source maps via the TypeScript compiler to then map the positions to those in the original .ts file. I don't even know if these maps would get distributed on the VSCode marketplace.

We can still (later on) write a small script for ourselves that takes in a given user log and the Manim Notebook version used, then checks out the respective code on GitHub, generates the source maps and replaces the corresponding line and colon numbers in the log file.

VladimirFokow commented 3 days ago
- You can then reset the logger level to default: `Developer: Set Log Level...` -> `Manim Notebook` -> `Info`
Splines commented 3 days ago

Thanks @VladimirFokow, that's a good idea, otherwise users might complain about performance. I've also updated the Regex to match another case, see the docstrings. And include the line number.

As approvals don't get dismissed when adding new commits (due to repo settings): do you still approve?

VladimirFokow commented 3 days ago

yes