Manim-Notebook / manim-notebook

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

Add logging statements all over the place #57

Closed Splines closed 3 days ago

Splines commented 3 days ago

In #56, we introduced a new logging mechanism. Here, we make use of that to log many important steps in the program, mainly for the ManimShell and the code preview. Note that as described in the Readme, the default logging level is Info, so adding these debug or trace logging statements should not be a performance problem.

I've also added a custom Window class that we can use (note W instead of w). Before showing the actual notification to the user, it will also log its message with respective log levels.

VladimirFokow commented 3 days ago

haha, these emojisπŸ˜„

Splines commented 3 days ago

haha, yeah I like this a lot for debugging purposes as it helps me to visually filter the relevant statements. And the icons themselves are really not that important, just that they differ from one another.

VladimirFokow commented 3 days ago

Is the old log file ever cleared?

I just reloaded the window, opened the log file, but all my old logs are still there..

(I thought the README says to reload the window - in order for the old logs to be removed?)

Splines commented 3 days ago

The log management is taken care of by VSCode itself. When you reload the window, the old log file will have the same content. However, VSCode creates a new folder in a temporary directory with a fresh new log file. Just use the Manim Notebook: Open Log File command again.

And yes, the Readme says to reload the window, such that VSCode is creating a new logfile for us.

VladimirFokow commented 3 days ago

For me: "Manim Notebook: Open Log File" still opens the SAME log file.. Even when you REstart the extension debugging session.

What makes it open the NEW log file: STOPPING the extension debugging session. THEN starting it

Splines commented 3 days ago

So can you confirm the behavior is different than this? Note how the second log file resides in exthost17 and not exthost16 anymore (see the breadcrumbs).

https://github.com/user-attachments/assets/d0ac98c8-8361-42b1-ac0b-3aaeae496179

VladimirFokow commented 3 days ago

Yes, definitely different.

The same log file opens.

Here are these logs, you see the extension restarting:

2024-10-29 15:22:12.677 [info] [extension.js:65:21] [activate] Manim Notebook activated
2024-10-29 15:22:56.963 [info] [extension.ts:51:11] [unknown] πŸ’  Command requested: Open Log File
2024-10-29 15:23:00.470 [info] [extension.ts:51:11] [unknown] πŸ’  Command requested: Open Log File
2024-10-29 15:23:01.369 [info] [extension.ts:51:11] [unknown] πŸ’  Command requested: Open Log File
2024-10-29 15:23:02.037 [info] [extension.ts:51:11] [unknown] πŸ’  Command requested: Open Log File
2024-10-29 15:23:02.624 [info] [extension.ts:51:11] [unknown] πŸ’  Command requested: Open Log File
2024-10-29 15:23:03.300 [info] [extension.ts:51:11] [unknown] πŸ’  Command requested: Open Log File
2024-10-29 15:23:04.485 [info] [extension.ts:51:11] [unknown] πŸ’  Command requested: Open Log File
2024-10-29 15:23:09.581 [info] [extension.ts:69:9] [unknown] πŸ’  Manim Notebook extension deactivated
2024-10-29 15:23:13.199 [info] [extension.js:65:21] [activate] Manim Notebook activated
2024-10-29 15:23:15.019 [info] [extension.ts:51:11] [unknown] πŸ’  Command requested: Open Log File
2024-10-29 15:23:19.077 [info] [extension.ts:51:11] [unknown] πŸ’  Command requested: Open Log File

Looks like this is another MacOS-related issue for us with @bhoov ..

VladimirFokow commented 3 days ago

This can be moved to an issue as a bug, but this PR can be merged (if nobody knows how to solve this issue in this PR)

Splines commented 3 days ago

Yeah, as this PR is just adding simple log statements, fixes like these would be better suited for a subsequent one. Thanks for approving.