ArchipelagoMW / Archipelago

Archipelago Multi-Game Randomizer and Server
https://archipelago.gg
Other
412 stars 557 forks source link

Core: smarter fill logging #3575

Open kedNalatacId opened 2 weeks ago

kedNalatacId commented 2 weeks ago

Please format your title with what portion of the project this pull request is targeting and what it's changing.

ex. "MyGame4: implement new game" or "Docs: add new guide for customizing MyGame3"

What is this fixing or adding?

Replace current Fill logging with a more dynamic logging mechanism. Scales appropriately between small, medium, and large seeds.

It doesn't log anything smaller than "min_size" (currently set to 1000 to match pre-existing logic). It doesn't log any faster than "min_time" (currently 1/4 second).

Because of the introduction of carriage return, safeguards are put in to make sure any output heading to a non-tty location don't include said carriage return (it does nasty things to log files).

How was this tested?

Generating many, many seeds and watching them. Genned:

All tests were done with python 3.11.

If this makes graphical changes, please attach screenshots.

Note status when done:

Screenshot 2024-06-20 at 17 44 20

Action shot: smarter_fill_logging-20240620-short

[edit to add: log files are also changed; this can be rolled back easily if requested] In the log file:

Screenshot 2024-07-04 at 15 55 49
beauxq commented 5 days ago

What does the log file look like with this? Does it add a line for every placed item? or every quarter second?

kedNalatacId commented 5 days ago

What does the log file look like with this? Does it add a line for every placed item? or every quarter second?

If you're talking about the screenshot, it's updating at most every quarter second (the "min_time" field specifies minimum time elapsed between logging updates). If quarter second is seen as too fast for logging updates it's pretty easy to slow it down by bumping the min_time field. The "min_time" field is only applicable to tty-based logging. The other field (min_size) is for non-tty based logging (to files or pipes), and specifies the smallest size increment there as 1000 items.

If you're talking about logs in the logs directory there's currently a bug such that those log files are receiving carriage returns and obviously shouldn't be (receiving tty logs when they should only get non-tty logs). I only discovered this issue recently and have an update I'll be pushing soon to address it (it can take a while to test logging for all sizes of seeds).