Rseding91 wrote: Sun Jun 02, 2019 10:28 pm
Ever since log() was made available during the data stage in Factorio modding mods have been spamming log files. It's so bad that log files end up 10s of thousands of lines adding up to several megabytes worth of useless nothing.
Another plan (by Bilka): record everything sent through log() during the data stage and if an error is triggered during the data stage or by scenarios then actually write it to the log file. This would also have the --enable-data-log option to force everything to be written instead of buffered.
If I may suggest a couple of things that I'd prefer because they would make my life easier, and I think would still achieve your goal of eliminating spam for most people:
If you only write log output for *unpacked* mods, that'd make it automatically show up (many?) developers. Unpacked mods are far easier to go through the edit/reload/test cycle with, and that is also the time you are most likely to need to poke around debugging in the data stage.
Instead, or as well, if you captured that data temporarily, and wrote it out as part of a "crash dump" log when a mod failed, that'd solve the "authors need to see their data stage debugging information to fix / reproduce user problems" thing as well.
A per-mod data stage log, or shared data/control stage logs, plus any fatal exception stack trace, would also keep main log size down, and also make it easy for developers to get the information they needed in a single "please upload the crash file ..." request. Fancy people could even add a workflow to mods.factorio.com that'd prompt the user to upload that alongside their bug report...
Also, a scenario where data-stage logs are used for good (if a little spammy) purposes: "
Alien Biomes" creates a very large number of tiles (197-ish?), and having it installed with a couple other mods that add tiles in volume such as
Asphalt Roads (55-ish, IIRC) can overflow the tile table.
Alien Biomes logs a message about that during the data phase, along with a list of all the defined tile types (including the ones past the limit) which makes it much easier to go through and figure out what the issue is.
I think it is important to make that debuggable, especially since a couple other mod authors commented that their crash could only happen when there were too many tiles, "probably because alien biomes", which is kind of true (but not exactly Alien Biomes fault.)
That said... I was thinking about how to communicate that fact from the data stage to the runtime stage so that I could send a patch (or add a mod) that'd display the error when I loaded into a game. That way I'd have a warning that didn't involve a mod fatal exception and checking the logs to (a) find why, and (b) figure out if I had cut enough tiles out to get below the cap.
So perhaps that'd be a good thing to have. Maybe even in the Factorio core, so that it'd show up at the time the main menu displayed, and could give a summary of how many tiles each mod added? That'd be the best instant debug/fix choice for getting that in front of everyone.
Anyway, thanks for letting me talk so much, and thank you for working to address this issue. It definitely does cause some annoyance having to skip over spammy messages to find, eg, where Alien Biomes is explaining how to fix the crash I brought on myself.